@cbartens/bkit 6.1.0 → 6.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 -12
- package/.bkit/core/.agents/docs.md +1 -11
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +30 -9
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +25 -27
- package/.bkit/core/.agents/rules.md +22 -9
- package/.bkit/core/.bkit/README.md +13 -11
- package/.bkit/core/.bkit/authoring.md +58 -13
- package/.bkit/core/.bkit/cli.md +43 -33
- package/.bkit/core/.bkit/cloud.md +93 -30
- package/.bkit/core/.bkit/install.md +55 -16
- package/.bkit/core/.bkit/jsonl.md +24 -7
- package/.bkit/core/.bkit/pipeline.md +8 -8
- package/.bkit/core/.bkit/prompts.md +160 -43
- package/.bkit/core/.bkit/providers.md +99 -36
- package/.bkit/core/.bkit/templates.md +167 -37
- package/.bkit/core/.bkit/trackers.md +39 -6
- package/.bkit/core/.bkit/workflows.md +344 -136
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +50 -27
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +11 -11
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +13 -8
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +14 -25
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +20 -9
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +8 -8
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +14 -4
- package/.bkit/core/.opencode/plugin/bkit-guardrails.js +114 -0
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +30 -6
- package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-cost.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-database.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +32 -2
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -3
- package/.bkit/core/docs/templates/bkit-audit-issues.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-llm.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-logs.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-models.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-security.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-testing.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
- package/.bkit/core/docs/templates/bkit-plan.md +38 -8
- package/.bkit/core/engine/checks/after/auth.ts +118 -47
- package/.bkit/core/engine/checks/after/github.ts +161 -37
- package/.bkit/core/engine/checks/after/index.ts +18 -3
- package/.bkit/core/engine/checks/after/tools.ts +245 -1
- package/.bkit/core/engine/checks/before/files.ts +59 -1
- package/.bkit/core/engine/checks/before/index.ts +8 -0
- package/.bkit/core/engine/checks/status-holes.ts +20 -26
- package/.bkit/core/engine/checks/tips/catalogue.ts +107 -10
- package/.bkit/core/engine/checks/tips/detect.ts +36 -3
- package/.bkit/core/engine/checks/tips/index.ts +1 -1
- package/.bkit/core/engine/cli.ts +13 -13
- package/.bkit/core/engine/commands/ci/ci.ts +124 -19
- package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
- package/.bkit/core/engine/commands/install/doctor.ts +5 -5
- package/.bkit/core/engine/commands/install/install.ts +28 -25
- package/.bkit/core/engine/commands/install/uninstall.ts +42 -30
- package/.bkit/core/engine/commands/install/upgrade.ts +14 -2
- package/.bkit/core/engine/commands/land.ts +2 -3
- package/.bkit/core/engine/commands/lib.ts +394 -39
- package/.bkit/core/engine/commands/registry.ts +1 -1
- package/.bkit/core/engine/commands/workflow/branches.ts +351 -78
- package/.bkit/core/engine/commands/workflow/challenge.ts +63 -14
- package/.bkit/core/engine/commands/workflow/context.ts +71 -10
- package/.bkit/core/engine/commands/workflow/counters.ts +298 -23
- package/.bkit/core/engine/commands/workflow/decisions.ts +260 -125
- package/.bkit/core/engine/commands/workflow/disk.ts +2 -1
- package/.bkit/core/engine/commands/workflow/feature-base.ts +66 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +312 -17
- package/.bkit/core/engine/commands/workflow/junit.ts +204 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +904 -99
- package/.bkit/core/engine/commands/workflow/locks.ts +186 -29
- package/.bkit/core/engine/commands/workflow/loops.ts +87 -0
- package/.bkit/core/engine/commands/workflow/open-decision.ts +251 -0
- package/.bkit/core/engine/commands/workflow/plan-blocks.ts +8 -0
- package/.bkit/core/engine/commands/workflow/plans.ts +1 -1
- package/.bkit/core/engine/commands/workflow/prs.ts +311 -16
- package/.bkit/core/engine/commands/workflow/repo.ts +1 -1
- package/.bkit/core/engine/commands/workflow/run-facts.ts +6 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +877 -174
- package/.bkit/core/engine/commands/workflow/runtime.ts +12 -4
- package/.bkit/core/engine/commands/workflow/status.ts +324 -11
- package/.bkit/core/engine/commands/workflow/step-table.ts +41 -15
- package/.bkit/core/engine/commands/workflow/steps.ts +604 -29
- package/.bkit/core/engine/commands/workflow/summary-findings.ts +1 -1
- package/.bkit/core/engine/commands/workflow/summary.ts +314 -8
- package/.bkit/core/engine/commands/workflow/tasks.ts +400 -27
- package/.bkit/core/engine/commands/workflow/tests-base.ts +319 -0
- package/.bkit/core/engine/commands/workflow/tests-changed.ts +138 -74
- package/.bkit/core/engine/commands/workflow/tests-jump.ts +93 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +815 -182
- package/.bkit/core/engine/commands/workflow/tracker.ts +1134 -137
- package/.bkit/core/engine/commands/workflow/workflows.ts +100 -72
- package/.bkit/core/engine/commands/workflow/worktrees.ts +421 -57
- package/.bkit/core/engine/install/cloud-env.ts +38 -10
- package/.bkit/core/engine/install/managed-block.ts +105 -0
- package/.bkit/core/engine/install/manifest.ts +7 -1
- package/.bkit/core/engine/install/modules/claude.ts +6 -2
- package/.bkit/core/engine/install/modules/cloud.ts +84 -95
- package/.bkit/core/engine/install/modules/codex.ts +10 -2
- package/.bkit/core/engine/install/modules/core.ts +202 -26
- package/.bkit/core/engine/install/modules/opencode.ts +18 -23
- package/.bkit/core/engine/install/network-allowlist.ts +8 -3
- package/.bkit/core/engine/install/project-docs.ts +650 -0
- package/.bkit/core/engine/install/template-copies.ts +58 -5
- package/.bkit/core/engine/install/write.ts +128 -7
- package/.bkit/core/engine/ledgers/journal.ts +18 -10
- package/.bkit/core/engine/ledgers/migrate.ts +20 -8
- package/.bkit/core/engine/ledgers/status.ts +604 -8
- package/.bkit/core/engine/ledgers/telemetry.ts +115 -13
- package/.bkit/core/engine/render/trackers.ts +46 -11
- package/.bkit/core/engine/shared/package-manager.ts +7 -3
- package/.bkit/core/engine/shared/settings.ts +12 -1
- package/.bkit/core/engine/shared/text.ts +14 -0
- package/.bkit/core/engine/tools/instructions-sources.ts +1 -0
- package/.bkit/core/engine/tools/instructions.ts +116 -20
- package/.bkit/core/hooks/antigravity-hook.js +20 -4
- package/.bkit/core/hooks/gateguard-edit-payload.js +8 -5
- package/.bkit/core/hooks/gateguard-engine.js +249 -23
- package/.bkit/core/hooks/guardrails-deny.js +167 -0
- package/.bkit/core/hooks/guardrails-read.js +3 -3
- package/.bkit/core/hooks/guardrails-shell.js +1122 -167
- package/.bkit/core/hooks/guardrails-tiers.js +247 -176
- package/.bkit/core/hooks/preflight-tracker.sh +219 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +23 -6
- package/.bkit/core/prompts/bkit-build-challenge-1.md +5 -4
- package/.bkit/core/prompts/bkit-build-challenge-2.md +6 -5
- package/.bkit/core/prompts/bkit-build-install-skills.md +2 -2
- package/.bkit/core/prompts/bkit-build-plan-convert.md +21 -7
- package/.bkit/core/prompts/bkit-build-plan-current.md +5 -4
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +22 -17
- package/.bkit/core/prompts/bkit-build-plan-tasks.md +16 -12
- package/.bkit/core/prompts/bkit-build-plan-tests.md +14 -10
- package/.bkit/core/prompts/bkit-build-plan-verify.md +21 -8
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +10 -5
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +22 -6
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +19 -3
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +22 -6
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +10 -7
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +3 -3
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +4 -4
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +3 -3
- package/.bkit/core/prompts/bkit-design-generate.md +6 -4
- package/.bkit/core/prompts/bkit-design-organise.md +4 -3
- package/.bkit/core/prompts/bkit-design-review-1.md +5 -4
- package/.bkit/core/prompts/bkit-design-review-2.md +6 -5
- package/.bkit/core/prompts/bkit-design-spike.md +4 -3
- package/.bkit/core/prompts/bkit-design-update.md +6 -4
- package/.bkit/core/prompts/bkit-plan-generate.md +35 -14
- package/.bkit/core/prompts/bkit-plan-review-1.md +9 -7
- package/.bkit/core/prompts/bkit-plan-review-2.md +9 -7
- package/.bkit/core/prompts/bkit-plan-scope-check.md +8 -6
- package/.bkit/core/prompts/bkit-plan-update.md +22 -8
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +11 -8
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +9 -5
- package/.bkit/core/prompts/bkit-ship-update-docs.md +26 -4
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +3 -3
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +10 -7
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +8 -5
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +31 -7
- package/.bkit/core/prompts/bkit-utility-update-failures.md +8 -5
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +10 -7
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -4
- package/.bkit/core/prompts/bkit-utility-update-tracker.md +4 -4
- package/.bkit/core/workflows/bkit-auto.md +23 -11
- package/.bkit/core/workflows/bkit-build.md +331 -100
- package/.bkit/core/workflows/bkit-debug.md +135 -64
- package/.bkit/core/workflows/bkit-design.md +58 -32
- package/.bkit/core/workflows/bkit-plan.md +73 -45
- package/.bkit/core/workflows/bkit-ship.md +233 -167
- package/.bkit/shared/.agents/plugins/bkit/hooks.json +1 -1
- package/.bkit/shared/.bkit/.env.example +5 -0
- package/.bkit/shared/.claude/bkit-cloud.md +7 -7
- package/.bkit/shared/.claude/settings.json +5 -1
- package/.bkit/shared/.cursor/bkit-cloud.md +1 -1
- package/.bkit/shared/.cursor/hooks.json +1 -1
- package/.bkit/shared/.opencode/opencode.json +11 -2
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +27 -0
- package/.bkit/templates/.cursor/Dockerfile +7 -7
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +1 -1
- package/.bkit/templates/.github/dependabot.yml +5 -0
- package/.bkit/templates/.github/renovate.json5 +5 -3
- package/.bkit/templates/.github/workflows/bkit-ci.yml +11 -11
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +525 -161
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +2 -2
- package/.bkit/templates/.husky/pre-push +123 -6
- package/.bkit/templates/context/bkit-serena.md +1 -1
- package/.bkit/templates/context/bkit-vercel.md +103 -59
- package/.bkit/templates/docs/architecture.md +98 -0
- package/.bkit/templates/docs/capabilities.md +33 -37
- package/.bkit/templates/docs/components.md +142 -0
- package/.bkit/templates/docs/data-schema.md +87 -0
- package/.bkit/{shared → templates}/docs/deployments.md +128 -142
- package/.bkit/templates/docs/design.md +117 -0
- package/.bkit/templates/docs/noise.md +54 -0
- package/.bkit/templates/docs/observability.md +99 -0
- package/.bkit/templates/docs/security.md +137 -0
- package/.bkit/templates/docs/setup.md +93 -0
- package/.bkit/templates/docs/technology.md +70 -0
- package/.bkit/{shared → templates}/docs/testing.md +200 -87
- package/.bkit/templates/scripts/ci/bkit-check-accepted-divergences.mjs +1 -6
- package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +511 -103
- package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +314 -28
- package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +500 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +91 -62
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
- package/.bkit/templates/slop-scan.config.json +2 -0
- package/CHANGELOG.md +79 -0
- package/DETAILS.md +661 -0
- package/README.md +73 -604
- package/dist/checks/after/auth.js +114 -46
- package/dist/checks/after/github.js +138 -35
- package/dist/checks/after/index.js +16 -4
- package/dist/checks/after/tools.js +224 -1
- package/dist/checks/before/files.js +59 -1
- package/dist/checks/before/index.js +7 -1
- package/dist/checks/status-holes.js +20 -21
- package/dist/checks/tips/catalogue.js +99 -10
- package/dist/checks/tips/detect.js +35 -3
- package/dist/checks/tips/index.js +1 -1
- package/dist/cli.js +13 -13
- package/dist/commands/ci/ci.js +113 -20
- package/dist/commands/ci/push-gate.js +79 -44
- package/dist/commands/install/doctor.js +5 -5
- package/dist/commands/install/install.js +23 -22
- package/dist/commands/install/uninstall.js +36 -30
- package/dist/commands/install/upgrade.js +10 -2
- package/dist/commands/land.js +2 -3
- package/dist/commands/lib.js +323 -25
- package/dist/commands/workflow/branches.js +312 -72
- package/dist/commands/workflow/challenge.js +66 -13
- package/dist/commands/workflow/context.js +46 -10
- package/dist/commands/workflow/counters.js +231 -23
- package/dist/commands/workflow/decisions.js +221 -106
- package/dist/commands/workflow/disk.js +2 -1
- package/dist/commands/workflow/feature-base.js +60 -0
- package/dist/commands/workflow/issues.js +243 -15
- package/dist/commands/workflow/junit.js +137 -0
- package/dist/commands/workflow/ledgers.js +726 -112
- package/dist/commands/workflow/locks.js +150 -29
- package/dist/commands/workflow/loops.js +67 -0
- package/dist/commands/workflow/open-decision.js +199 -0
- package/dist/commands/workflow/plan-blocks.js +6 -0
- package/dist/commands/workflow/plans.js +1 -1
- package/dist/commands/workflow/prs.js +272 -16
- package/dist/commands/workflow/repo.js +1 -1
- package/dist/commands/workflow/run-facts.js +6 -0
- package/dist/commands/workflow/runs.js +747 -155
- package/dist/commands/workflow/runtime.js +8 -4
- package/dist/commands/workflow/status.js +259 -13
- package/dist/commands/workflow/step-table.js +41 -15
- package/dist/commands/workflow/steps.js +530 -26
- package/dist/commands/workflow/summary-findings.js +1 -1
- package/dist/commands/workflow/summary.js +289 -8
- package/dist/commands/workflow/tasks.js +294 -27
- package/dist/commands/workflow/tests-base.js +266 -0
- package/dist/commands/workflow/tests-changed.js +130 -56
- package/dist/commands/workflow/tests-jump.js +77 -0
- package/dist/commands/workflow/tests.js +608 -131
- package/dist/commands/workflow/tracker.js +920 -112
- package/dist/commands/workflow/workflows.js +80 -59
- package/dist/commands/workflow/worktrees.js +387 -58
- package/dist/install/cloud-env.js +32 -10
- package/dist/install/managed-block.js +101 -0
- package/dist/install/manifest.js +7 -1
- package/dist/install/modules/claude.js +6 -2
- package/dist/install/modules/cloud.js +73 -86
- package/dist/install/modules/codex.js +9 -2
- package/dist/install/modules/core.js +190 -27
- package/dist/install/modules/opencode.js +18 -23
- package/dist/install/network-allowlist.js +8 -3
- package/dist/install/project-docs.js +551 -0
- package/dist/install/template-copies.js +55 -5
- package/dist/install/write.js +117 -5
- package/dist/ledgers/journal.js +10 -8
- package/dist/ledgers/migrate.js +20 -9
- package/dist/ledgers/status.js +461 -8
- package/dist/ledgers/telemetry.js +71 -13
- package/dist/render/trackers.js +21 -12
- package/dist/shared/package-manager.js +7 -2
- package/dist/shared/settings.js +8 -0
- package/dist/shared/text.js +13 -0
- package/dist/tools/instructions-sources.js +1 -0
- package/dist/tools/instructions.js +97 -24
- package/package.json +23 -15
- package/.bkit/core/hooks/preflight-linear.sh +0 -73
- package/.bkit/shared/docs/architecture.md +0 -16
- package/.bkit/shared/docs/data-schema.md +0 -16
- package/.bkit/shared/docs/design.md +0 -38
- package/.bkit/shared/docs/noise.md +0 -20
- package/.bkit/shared/docs/observability.md +0 -22
- package/.bkit/shared/docs/security.md +0 -62
- package/.bkit/shared/docs/setup.md +0 -52
- package/.bkit/shared/docs/technology.md +0 -15
- /package/.bkit/templates/{.lintstagedrc.json → lintstagedrc.example.json} +0 -0
- /package/.bkit/templates/{.prettierignore → prettierignore.example} +0 -0
|
@@ -39,6 +39,40 @@ function ghFailure(res, what) {
|
|
|
39
39
|
* merged PR but must not adopt an abandoned one.
|
|
40
40
|
*/
|
|
41
41
|
export function probePr(cwd, opts) {
|
|
42
|
+
const qualify = (pr) => opts.shipEntry === true && pr?.state === "MERGED"
|
|
43
|
+
? qualifyMergedEntry(cwd, pr, opts.head, opts.base)
|
|
44
|
+
: { kind: "ok", pr };
|
|
45
|
+
if (opts.facts !== undefined) {
|
|
46
|
+
const facts = opts.facts;
|
|
47
|
+
if (opts.shipEntry !== true ||
|
|
48
|
+
opts.repo === undefined ||
|
|
49
|
+
opts.head === undefined ||
|
|
50
|
+
opts.base === undefined ||
|
|
51
|
+
typeof facts !== "object" ||
|
|
52
|
+
facts === null ||
|
|
53
|
+
!("ownerRepo" in facts) ||
|
|
54
|
+
facts.ownerRepo !== opts.repo ||
|
|
55
|
+
!("headRefName" in facts) ||
|
|
56
|
+
facts.headRefName !== opts.head ||
|
|
57
|
+
!("baseRefName" in facts) ||
|
|
58
|
+
facts.baseRefName !== opts.base ||
|
|
59
|
+
!("pr" in facts))
|
|
60
|
+
return {
|
|
61
|
+
kind: "failed",
|
|
62
|
+
message: "ship PR facts require matching ownerRepo, headRefName and baseRefName scope",
|
|
63
|
+
};
|
|
64
|
+
if (facts.pr === null)
|
|
65
|
+
return qualify(undefined);
|
|
66
|
+
if (!validPrFacts(facts.pr) ||
|
|
67
|
+
prRepoSlug(facts.pr.url) !== opts.repo ||
|
|
68
|
+
facts.pr.headRefName !== opts.head ||
|
|
69
|
+
facts.pr.baseRefName !== opts.base)
|
|
70
|
+
return {
|
|
71
|
+
kind: "failed",
|
|
72
|
+
message: "ship PR facts have an unreadable or mismatched PR identity, head or base scope",
|
|
73
|
+
};
|
|
74
|
+
return qualify(facts.pr);
|
|
75
|
+
}
|
|
42
76
|
if (opts.number !== undefined) {
|
|
43
77
|
const args = ["pr", "view", opts.number, "--json", `${PR_FIELDS},mergeable`];
|
|
44
78
|
if (opts.repo !== undefined)
|
|
@@ -49,7 +83,7 @@ export function probePr(cwd, opts) {
|
|
|
49
83
|
const parsed = parseJson(res.stdout);
|
|
50
84
|
if (!parsed.ok)
|
|
51
85
|
return { kind: "failed", message: "gh pr view printed no JSON" };
|
|
52
|
-
return
|
|
86
|
+
return qualify(parsed.value);
|
|
53
87
|
}
|
|
54
88
|
const args = ["pr", "list", "--head", opts.head, "--state", opts.state, "--json", PR_FIELDS];
|
|
55
89
|
if (opts.base !== undefined)
|
|
@@ -67,7 +101,80 @@ export function probePr(cwd, opts) {
|
|
|
67
101
|
const pr = opts.state === "open"
|
|
68
102
|
? prs[0]
|
|
69
103
|
: (prs.find((p) => p.state === "OPEN") ?? prs.find((p) => p.state === "MERGED"));
|
|
70
|
-
return
|
|
104
|
+
return qualify(pr);
|
|
105
|
+
}
|
|
106
|
+
export function validPrFacts(value) {
|
|
107
|
+
if (typeof value !== "object" || value === null)
|
|
108
|
+
return false;
|
|
109
|
+
return ("number" in value &&
|
|
110
|
+
typeof value.number === "number" &&
|
|
111
|
+
Number.isSafeInteger(value.number) &&
|
|
112
|
+
value.number > 0 &&
|
|
113
|
+
"url" in value &&
|
|
114
|
+
typeof value.url === "string" &&
|
|
115
|
+
"state" in value &&
|
|
116
|
+
typeof value.state === "string" &&
|
|
117
|
+
["OPEN", "MERGED", "CLOSED"].includes(value.state) &&
|
|
118
|
+
"baseRefName" in value &&
|
|
119
|
+
typeof value.baseRefName === "string" &&
|
|
120
|
+
"headRefName" in value &&
|
|
121
|
+
typeof value.headRefName === "string" &&
|
|
122
|
+
"headRefOid" in value &&
|
|
123
|
+
typeof value.headRefOid === "string" &&
|
|
124
|
+
/^[0-9a-f]{40,64}$/i.test(value.headRefOid) &&
|
|
125
|
+
"title" in value &&
|
|
126
|
+
typeof value.title === "string" &&
|
|
127
|
+
"mergeCommit" in value &&
|
|
128
|
+
(value.mergeCommit === null ||
|
|
129
|
+
(typeof value.mergeCommit === "object" &&
|
|
130
|
+
"oid" in value.mergeCommit &&
|
|
131
|
+
typeof value.mergeCommit.oid === "string")));
|
|
132
|
+
}
|
|
133
|
+
function qualifyMergedEntry(cwd, pr, head, base) {
|
|
134
|
+
if (!head ||
|
|
135
|
+
pr.headRefName !== head ||
|
|
136
|
+
pr.baseRefName !== (base ?? DEV) ||
|
|
137
|
+
!/^[0-9a-f]{40,64}$/i.test(pr.headRefOid))
|
|
138
|
+
return {
|
|
139
|
+
kind: "failed",
|
|
140
|
+
message: "merged ship entry has unreadable or mismatched feature head/base evidence",
|
|
141
|
+
};
|
|
142
|
+
const local = git(cwd, ["rev-parse", "--verify", "--quiet", `refs/heads/${head}^{commit}`]);
|
|
143
|
+
if (local === null)
|
|
144
|
+
return { kind: "failed", message: `cannot read local feature evidence for ${head}` };
|
|
145
|
+
const remote = runGit(cwd, ["ls-remote", "--heads", "origin", `refs/heads/${head}`]);
|
|
146
|
+
if (!remote.ok)
|
|
147
|
+
return {
|
|
148
|
+
kind: "failed",
|
|
149
|
+
message: `cannot read remote feature evidence for ${head}: ${remote.stderr}`,
|
|
150
|
+
};
|
|
151
|
+
let remoteHead = null;
|
|
152
|
+
if (remote.stdout.trim() !== "") {
|
|
153
|
+
const fetched = runGit(cwd, [
|
|
154
|
+
"fetch",
|
|
155
|
+
"origin",
|
|
156
|
+
`+refs/heads/${head}:refs/remotes/origin/${head}`,
|
|
157
|
+
]);
|
|
158
|
+
if (!fetched.ok)
|
|
159
|
+
return {
|
|
160
|
+
kind: "failed",
|
|
161
|
+
message: `cannot fetch feature evidence for ${head}: ${fetched.stderr}`,
|
|
162
|
+
};
|
|
163
|
+
remoteHead = git(cwd, [
|
|
164
|
+
"rev-parse",
|
|
165
|
+
"--verify",
|
|
166
|
+
"--quiet",
|
|
167
|
+
`refs/remotes/origin/${head}^{commit}`,
|
|
168
|
+
]);
|
|
169
|
+
if (remoteHead === null)
|
|
170
|
+
return { kind: "failed", message: `cannot read fetched feature evidence for ${head}` };
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
kind: "ok",
|
|
174
|
+
pr: local === pr.headRefOid && (remoteHead === null || remoteHead === pr.headRefOid)
|
|
175
|
+
? pr
|
|
176
|
+
: undefined,
|
|
177
|
+
};
|
|
71
178
|
}
|
|
72
179
|
export function prOutput(pr) {
|
|
73
180
|
return {
|
|
@@ -323,7 +430,11 @@ export const EXIT_BASE_NOT_DEV = 8;
|
|
|
323
430
|
* EXIT.USE_MCP (merge through `merge_pull_request` with `subject`).
|
|
324
431
|
*/
|
|
325
432
|
export function mergePr(cwd, o, log) {
|
|
326
|
-
|
|
433
|
+
if (o.shipRetry && !o.matchHead)
|
|
434
|
+
throw new CommandError(EXIT.USAGE, "--ship-retry requires --match-head");
|
|
435
|
+
if (o.shipRetry && o.deleteBranch)
|
|
436
|
+
throw new CommandError(EXIT.USAGE, "--ship-retry leaves branch cleanup to guarded workflow close");
|
|
437
|
+
const read = () => probePr(cwd, { number: o.number, state: "open", repo: o.repo });
|
|
327
438
|
const result = (code, pr, already) => {
|
|
328
439
|
const merged = pr?.state === "MERGED";
|
|
329
440
|
return {
|
|
@@ -336,17 +447,81 @@ export function mergePr(cwd, o, log) {
|
|
|
336
447
|
subject: o.subject,
|
|
337
448
|
verdict: merged ? "PASS" : "FAIL",
|
|
338
449
|
failures: merged ? 0 : 1,
|
|
450
|
+
...(o.shipRetry
|
|
451
|
+
? {
|
|
452
|
+
route: merged ? "merged" : "stop",
|
|
453
|
+
reason: merged ? "PR merged" : "merge refused",
|
|
454
|
+
}
|
|
455
|
+
: {}),
|
|
339
456
|
},
|
|
340
457
|
};
|
|
341
458
|
};
|
|
342
|
-
const
|
|
459
|
+
const stop = (code, reason, pr) => {
|
|
460
|
+
log(reason);
|
|
461
|
+
const r = result(code, pr, false);
|
|
462
|
+
return o.shipRetry ? { ...r, out: { ...r.out, route: "stop", reason } } : r;
|
|
463
|
+
};
|
|
464
|
+
const classify = (pr) => {
|
|
465
|
+
if (!o.shipRetry || pr?.state === "MERGED")
|
|
466
|
+
return result(EXIT.OK, pr, false);
|
|
467
|
+
if (pr?.baseRefName !== DEV)
|
|
468
|
+
return stop(EXIT_BASE_NOT_DEV, "merge reread base is not dev", pr);
|
|
469
|
+
if (pr.state !== "OPEN")
|
|
470
|
+
return stop(EXIT_NOT_MERGED, "merge refused: PR is not open", pr);
|
|
471
|
+
if (!/^[0-9a-f]{40,64}$/i.test(pr.headRefOid))
|
|
472
|
+
return stop(EXIT_GH_FAILED, "merge head reread is unavailable", pr);
|
|
473
|
+
const moved = pr.headRefOid !== o.matchHead;
|
|
474
|
+
const conflict = pr.mergeable === "CONFLICTING";
|
|
475
|
+
if (!moved && !conflict)
|
|
476
|
+
return stop(EXIT_NOT_MERGED, "merge refused without a moved head or new dev conflict", pr);
|
|
477
|
+
const reason = moved
|
|
478
|
+
? "PR head moved after validation; revalidate the new head"
|
|
479
|
+
: "PR conflicts with dev; integrate the fresh base";
|
|
480
|
+
log(reason);
|
|
481
|
+
const r = result(moved ? 9 : 10, pr, false);
|
|
482
|
+
return { ...r, out: { ...r.out, route: moved ? "revalidate" : "integrate", reason } };
|
|
483
|
+
};
|
|
484
|
+
let before;
|
|
485
|
+
let afterFacts;
|
|
486
|
+
if (o.facts !== undefined) {
|
|
487
|
+
const facts = o.facts;
|
|
488
|
+
if (!o.shipRetry ||
|
|
489
|
+
!o.repo ||
|
|
490
|
+
typeof facts !== "object" ||
|
|
491
|
+
facts === null ||
|
|
492
|
+
!("ownerRepo" in facts) ||
|
|
493
|
+
facts.ownerRepo !== o.repo ||
|
|
494
|
+
!("prNumber" in facts) ||
|
|
495
|
+
facts.prNumber !== Number(o.number) ||
|
|
496
|
+
!("matchHead" in facts) ||
|
|
497
|
+
facts.matchHead !== o.matchHead ||
|
|
498
|
+
!("headRefName" in facts) ||
|
|
499
|
+
typeof facts.headRefName !== "string" ||
|
|
500
|
+
!("baseRefName" in facts) ||
|
|
501
|
+
facts.baseRefName !== DEV ||
|
|
502
|
+
!("before" in facts) ||
|
|
503
|
+
!validPrFacts(facts.before) ||
|
|
504
|
+
!("after" in facts) ||
|
|
505
|
+
!validPrFacts(facts.after) ||
|
|
506
|
+
[facts.before, facts.after].some((pr) => pr.number !== Number(o.number) ||
|
|
507
|
+
prRepoSlug(pr.url) !== o.repo ||
|
|
508
|
+
pr.headRefName !== facts.headRefName ||
|
|
509
|
+
pr.baseRefName !== DEV) ||
|
|
510
|
+
facts.before.headRefOid !== o.matchHead ||
|
|
511
|
+
facts.before.state !== "OPEN")
|
|
512
|
+
return stop(EXIT_GH_FAILED, "merge facts scope or independent post-attempt reread is unavailable or mismatched");
|
|
513
|
+
before = { kind: "ok", pr: facts.before };
|
|
514
|
+
afterFacts = facts.after;
|
|
515
|
+
}
|
|
516
|
+
else
|
|
517
|
+
before = read();
|
|
343
518
|
if (before.kind === "unavailable") {
|
|
344
519
|
log(`${before.message} — merge through merge_pull_request with this subject and an empty body`);
|
|
345
520
|
return result(EXIT.USE_MCP, undefined, false);
|
|
346
521
|
}
|
|
347
522
|
if (before.kind === "failed") {
|
|
348
523
|
log(before.message);
|
|
349
|
-
return
|
|
524
|
+
return stop(EXIT_GH_FAILED, before.message);
|
|
350
525
|
}
|
|
351
526
|
if (before.pr?.state === "MERGED")
|
|
352
527
|
return result(EXIT.OK, before.pr, true);
|
|
@@ -354,7 +529,17 @@ export function mergePr(cwd, o, log) {
|
|
|
354
529
|
log(`refusing to merge PR ${o.number}: its base is ${before.pr?.baseRefName ?? "unknown"}, not ${DEV} — bkit merges into ${DEV} only, releases stay manual`);
|
|
355
530
|
return result(EXIT_BASE_NOT_DEV, before.pr, false);
|
|
356
531
|
}
|
|
532
|
+
if (o.shipRetry &&
|
|
533
|
+
(before.pr.number !== Number(o.number) ||
|
|
534
|
+
(o.repo !== undefined && prRepoSlug(before.pr.url) !== o.repo)))
|
|
535
|
+
return stop(EXIT_GH_FAILED, "merge pre-attempt PR repository or number scope mismatch", before.pr);
|
|
536
|
+
if (o.shipRetry && before.pr.headRefOid !== o.matchHead)
|
|
537
|
+
return classify(before.pr);
|
|
538
|
+
if (afterFacts !== undefined)
|
|
539
|
+
return classify(afterFacts);
|
|
357
540
|
const args = ["pr", "merge", o.number, "--squash", "--subject", o.subject, "--body", ""];
|
|
541
|
+
if (o.repo !== undefined)
|
|
542
|
+
args.push("--repo", o.repo);
|
|
358
543
|
if (o.deleteBranch === true)
|
|
359
544
|
args.push("--delete-branch");
|
|
360
545
|
if (o.matchHead !== undefined)
|
|
@@ -368,16 +553,20 @@ export function mergePr(cwd, o, log) {
|
|
|
368
553
|
log(`gh pr merge ${o.number} failed: ${merged.stderr || `exit ${String(merged.status)}`}`);
|
|
369
554
|
const after = read();
|
|
370
555
|
if (after.kind !== "ok") {
|
|
371
|
-
|
|
372
|
-
return result(EXIT_GH_FAILED, undefined, false);
|
|
556
|
+
return stop(EXIT_GH_FAILED, `merge state reread unavailable: ${after.message}`);
|
|
373
557
|
}
|
|
558
|
+
if (o.shipRetry &&
|
|
559
|
+
(after.pr?.number !== Number(o.number) ||
|
|
560
|
+
after.pr.headRefName !== before.pr.headRefName ||
|
|
561
|
+
(o.repo !== undefined && prRepoSlug(after.pr.url) !== o.repo)))
|
|
562
|
+
return stop(EXIT_GH_FAILED, "merge post-attempt PR repository, number or branch scope mismatch", after.pr);
|
|
374
563
|
// A retarget between the base check and the merge is caught here, loudly.
|
|
375
564
|
if (after.pr?.state === "MERGED" && after.pr.baseRefName !== DEV) {
|
|
376
565
|
log(`INTEGRITY FAILURE: PR ${o.number} merged into ${after.pr.baseRefName ?? "an unknown base"}, not ${DEV} — its base changed after the check; revert the merge`);
|
|
377
566
|
const r = result(EXIT_BASE_NOT_DEV, after.pr, false);
|
|
378
567
|
return { ...r, out: { ...r.out, verdict: "FAIL", failures: 1 } };
|
|
379
568
|
}
|
|
380
|
-
return
|
|
569
|
+
return classify(after.pr);
|
|
381
570
|
}
|
|
382
571
|
/** Whether dev demands status checks (ruleset or branch protection): CI must then pass at the PR head. */
|
|
383
572
|
export function devRequiresChecks(gh, repo) {
|
|
@@ -442,17 +631,19 @@ export function updateBranch(cwd, number, log, o = {}) {
|
|
|
442
631
|
export const EXIT_CHECKS_UNREADABLE = 4;
|
|
443
632
|
/** Conclusions / states a finished check may carry and still count as passing. */
|
|
444
633
|
const PASS_STATES = new Set(["SUCCESS", "NEUTRAL", "SKIPPED"]);
|
|
634
|
+
/** Conclusions of a check that finished without running to a verdict: it neither passed nor went red. */
|
|
635
|
+
const NO_VERDICT_STATES = new Set(["CANCELLED", "ACTION_REQUIRED", "STALE"]);
|
|
445
636
|
/**
|
|
446
637
|
* The PR's check rollup, classified (ship Step 2's post-open assert). `green` only
|
|
447
|
-
* when at least one check exists and none is failed or pending. A check run is
|
|
638
|
+
* when at least one check exists and none is failed, cancelled or pending. A check run is
|
|
448
639
|
* open until `status` = `COMPLETED`; a commit status is open while its `state` is
|
|
449
|
-
* `PENDING` / `EXPECTED`. gh missing → EXIT.USE_MCP (read the
|
|
450
|
-
* `pull_request_read` `
|
|
640
|
+
* `PENDING` / `EXPECTED`. gh missing → EXIT.USE_MCP (read the check runs through
|
|
641
|
+
* `pull_request_read` `get_check_runs`, or `actions_list` runs for the head SHA).
|
|
451
642
|
*/
|
|
452
643
|
export function checksFor(cwd, number, log) {
|
|
453
644
|
const res = runGh(cwd, ["pr", "view", number, "--json", "statusCheckRollup"]);
|
|
454
645
|
if (ghUnavailable(res)) {
|
|
455
|
-
log("gh unavailable for gh pr view --json statusCheckRollup — read the
|
|
646
|
+
log("gh unavailable for gh pr view --json statusCheckRollup — read the check runs through pull_request_read (get_check_runs), or actions_list runs for the head SHA");
|
|
456
647
|
return { code: EXIT.USE_MCP, out: null };
|
|
457
648
|
}
|
|
458
649
|
if (!res.ok) {
|
|
@@ -468,6 +659,7 @@ export function checksFor(cwd, number, log) {
|
|
|
468
659
|
const checks = (Array.isArray(rawRollup) ? rawRollup : []);
|
|
469
660
|
let passing = 0;
|
|
470
661
|
let failed = 0;
|
|
662
|
+
let cancelled = 0;
|
|
471
663
|
let pending = 0;
|
|
472
664
|
const failing = [];
|
|
473
665
|
for (const c of checks) {
|
|
@@ -483,24 +675,28 @@ export function checksFor(cwd, number, log) {
|
|
|
483
675
|
else if (PASS_STATES.has(conclusion || state)) {
|
|
484
676
|
passing++;
|
|
485
677
|
}
|
|
678
|
+
else if (NO_VERDICT_STATES.has(conclusion || state)) {
|
|
679
|
+
cancelled++;
|
|
680
|
+
}
|
|
486
681
|
else {
|
|
487
682
|
failed++;
|
|
488
683
|
if (name)
|
|
489
684
|
failing.push(name);
|
|
490
685
|
}
|
|
491
686
|
}
|
|
492
|
-
const green = checks.length > 0 && failed === 0 && pending === 0;
|
|
687
|
+
const green = checks.length > 0 && failed === 0 && cancelled === 0 && pending === 0;
|
|
493
688
|
const out = {
|
|
494
689
|
number,
|
|
495
690
|
total: checks.length,
|
|
496
691
|
passing,
|
|
497
692
|
failed,
|
|
693
|
+
cancelled,
|
|
498
694
|
pending,
|
|
499
695
|
green,
|
|
500
696
|
failing,
|
|
501
697
|
};
|
|
502
698
|
if (!green)
|
|
503
|
-
log(`PR ${number} is not green: ${String(failed)} failed, ${String(pending)} pending, ${String(checks.length)} total`);
|
|
699
|
+
log(`PR ${number} is not green: ${String(failed)} failed, ${String(cancelled)} cancelled, ${String(pending)} pending, ${String(checks.length)} total`);
|
|
504
700
|
return { code: green ? EXIT.OK : EXIT.NO, out };
|
|
505
701
|
}
|
|
506
702
|
/** The latest row of `type` in the log, or undefined. */
|
|
@@ -749,6 +945,21 @@ export const prsCommand = {
|
|
|
749
945
|
{ name: "base", type: "string", help: "only PRs into this base (default: any base)" },
|
|
750
946
|
{ name: "state", type: "string", help: "open (default) | all: OPEN wins, then MERGED" },
|
|
751
947
|
{ name: "number", type: "string", help: "read this PR instead of listing by --head" },
|
|
948
|
+
{
|
|
949
|
+
name: "ship-entry",
|
|
950
|
+
type: "boolean",
|
|
951
|
+
help: "qualify a merged PR against fresh local and remote feature tips before resuming ship",
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
name: "owner-repo",
|
|
955
|
+
type: "string",
|
|
956
|
+
help: "owner/repo scope for ship entry and MCP facts",
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
name: "facts-file",
|
|
960
|
+
type: "string",
|
|
961
|
+
help: "ship entry: scoped MCP JSON {ownerRepo, headRefName, baseRefName, pr}, used without gh",
|
|
962
|
+
},
|
|
752
963
|
],
|
|
753
964
|
output: PR_OUTPUT_KEYS,
|
|
754
965
|
exitCodes: { 4: "gh errored — the probe could not answer" },
|
|
@@ -761,6 +972,12 @@ export const prsCommand = {
|
|
|
761
972
|
if (number !== undefined && !/^[1-9][0-9]*$/.test(number)) {
|
|
762
973
|
throw new CommandError(EXIT.USAGE, "--number must be a PR number");
|
|
763
974
|
}
|
|
975
|
+
const factsFile = str(ctx.flags.factsFile);
|
|
976
|
+
const facts = factsFile === undefined
|
|
977
|
+
? undefined
|
|
978
|
+
: parseJson(fs.readFileSync(path.resolve(ctx.cwd, factsFile), "utf-8"));
|
|
979
|
+
if (facts !== undefined && !facts.ok)
|
|
980
|
+
throw new CommandError(EXIT.USAGE, "ship PR facts file is not valid JSON");
|
|
764
981
|
const res = probePr(ctx.cwd, {
|
|
765
982
|
number,
|
|
766
983
|
state,
|
|
@@ -770,6 +987,9 @@ export const prsCommand = {
|
|
|
770
987
|
? currentBranch(ctx.cwd)
|
|
771
988
|
: refFlag(ctx.flags.head, "head"),
|
|
772
989
|
base: ctx.flags.base === undefined ? undefined : refFlag(ctx.flags.base, "base"),
|
|
990
|
+
repo: str(ctx.flags.ownerRepo),
|
|
991
|
+
shipEntry: ctx.flags.shipEntry === true,
|
|
992
|
+
facts: facts?.ok === true ? facts.value : undefined,
|
|
773
993
|
});
|
|
774
994
|
if (res.kind !== "ok") {
|
|
775
995
|
ctx.log(res.message);
|
|
@@ -783,6 +1003,21 @@ export const prsCommand = {
|
|
|
783
1003
|
summary: "Squash-merge a PR with an empty body (skipped when already MERGED) and read its state back.",
|
|
784
1004
|
use: "workflow",
|
|
785
1005
|
flags: [
|
|
1006
|
+
{
|
|
1007
|
+
name: "ship-retry",
|
|
1008
|
+
type: "boolean",
|
|
1009
|
+
help: "ship only: classify independently re-read merge refusals as revalidate (9), integrate (10), or stop (7)",
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "facts-file",
|
|
1013
|
+
type: "string",
|
|
1014
|
+
help: "with --ship-retry: scoped pre-attempt and independent post-attempt MCP PR facts; classify without another mutation",
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
name: "owner-repo",
|
|
1018
|
+
type: "string",
|
|
1019
|
+
help: "owner/repo for the merge and scoped MCP facts",
|
|
1020
|
+
},
|
|
786
1021
|
{ name: "number", type: "string", required: true, help: "the PR number" },
|
|
787
1022
|
{
|
|
788
1023
|
name: "subject",
|
|
@@ -815,19 +1050,37 @@ export const prsCommand = {
|
|
|
815
1050
|
subject: "the squash subject used",
|
|
816
1051
|
verdict: "PASS when merged, else FAIL",
|
|
817
1052
|
failures: "0 when merged, else 1",
|
|
1053
|
+
route: "--ship-retry: merged | revalidate | integrate | stop",
|
|
1054
|
+
reason: "--ship-retry: the reread decision or refusal",
|
|
818
1055
|
},
|
|
819
1056
|
exitCodes: {
|
|
820
1057
|
[EXIT_GH_FAILED]: "gh could not read the PR",
|
|
821
1058
|
[EXIT_NOT_MERGED]: "--expect-merged and the PR did not reach MERGED",
|
|
822
1059
|
[EXIT_BASE_NOT_DEV]: `the PR's base is not ${DEV}, or could not be read — nothing merged`,
|
|
1060
|
+
9: "--ship-retry: PR head moved; revalidate",
|
|
1061
|
+
10: "--ship-retry: new dev conflict; integrate",
|
|
823
1062
|
},
|
|
824
1063
|
run: (ctx) => {
|
|
825
1064
|
const number = String(ctx.flags.number);
|
|
826
1065
|
if (!/^[1-9][0-9]*$/.test(number))
|
|
827
1066
|
throw new CommandError(EXIT.USAGE, "--number must be a PR number");
|
|
1067
|
+
const factsPath = str(ctx.flags.factsFile);
|
|
1068
|
+
const parsed = factsPath === undefined
|
|
1069
|
+
? undefined
|
|
1070
|
+
: parseJson(fs.readFileSync(path.resolve(ctx.cwd, factsPath), "utf-8"));
|
|
1071
|
+
if (parsed !== undefined && !parsed.ok)
|
|
1072
|
+
throw new CommandError(EXIT.USAGE, "merge facts JSON is unreadable");
|
|
1073
|
+
const facts = parsed?.ok ? parsed.value : undefined;
|
|
828
1074
|
let subject = str(ctx.flags.subject);
|
|
829
1075
|
if (subject === undefined) {
|
|
830
|
-
const
|
|
1076
|
+
const candidate = typeof facts === "object" && facts !== null && "before" in facts
|
|
1077
|
+
? facts.before
|
|
1078
|
+
: undefined;
|
|
1079
|
+
const pr = facts !== undefined
|
|
1080
|
+
? validPrFacts(candidate)
|
|
1081
|
+
? { kind: "ok", pr: candidate }
|
|
1082
|
+
: { kind: "failed", message: "merge facts pre-attempt PR is unreadable" }
|
|
1083
|
+
: probePr(ctx.cwd, { number, state: "open", repo: str(ctx.flags.ownerRepo) });
|
|
831
1084
|
if (pr.kind === "unavailable") {
|
|
832
1085
|
ctx.log(`${pr.message} — merge through merge_pull_request`);
|
|
833
1086
|
return EXIT.USE_MCP;
|
|
@@ -845,6 +1098,9 @@ export const prsCommand = {
|
|
|
845
1098
|
subject,
|
|
846
1099
|
matchHead: str(ctx.flags.matchHead),
|
|
847
1100
|
deleteBranch: ctx.flags.deleteBranch === true,
|
|
1101
|
+
shipRetry: ctx.flags.shipRetry === true,
|
|
1102
|
+
repo: str(ctx.flags.ownerRepo),
|
|
1103
|
+
facts,
|
|
848
1104
|
}, ctx.log);
|
|
849
1105
|
ctx.emit(r.out);
|
|
850
1106
|
if (r.code !== EXIT.OK)
|
|
@@ -883,7 +1139,7 @@ export const prsCommand = {
|
|
|
883
1139
|
},
|
|
884
1140
|
},
|
|
885
1141
|
checks: {
|
|
886
|
-
summary: "A PR's check rollup, classified: green when present and none failed or pending (exit 80: use MCP).",
|
|
1142
|
+
summary: "A PR's check rollup, classified: green when present and none failed, cancelled or pending (exit 80: use MCP).",
|
|
887
1143
|
use: "by-hand",
|
|
888
1144
|
flags: [{ name: "number", type: "string", required: true, help: "the PR number" }],
|
|
889
1145
|
output: {
|
|
@@ -143,7 +143,7 @@ export const repoCommand = {
|
|
|
143
143
|
repoRoot: "the main checkout (the same from any worktree)",
|
|
144
144
|
bkit: "the bkit binary the workflow blocks call: <repoRoot>/node_modules/.bin/bkit, else `bkit` on PATH",
|
|
145
145
|
outboxRoot: "<git common dir>/bkit-outbox: per-run scratch files, never committed",
|
|
146
|
-
sessionDir: "<outboxRoot>/sessions/<utc-time>-<random>/: a new, empty folder per
|
|
146
|
+
sessionDir: "<outboxRoot>/sessions/<utc-time>-<random>/: a new, empty folder per invocation for prompt.md and issue files; pass it explicitly as --session-dir for workflow progress ownership; folders older than 7 days are pruned",
|
|
147
147
|
bkitVersion: ".bkit/version pinnedVersion: the release this repo's bkit files came from (null when unpinned)",
|
|
148
148
|
bkitLatest: "newest published @cbartens/bkit, asked at most once a day (null when offline, opted out via BKIT_NO_UPDATE_CHECK, or unpinned)",
|
|
149
149
|
bkitOutdated: "true when bkitVersion is older than bkitLatest (null when either is unknown)",
|
|
@@ -278,6 +278,12 @@ export const MARK_ROWS = new Set([
|
|
|
278
278
|
"test-run",
|
|
279
279
|
"engine-call",
|
|
280
280
|
"completeness",
|
|
281
|
+
"invocation",
|
|
282
|
+
"ci-handoff",
|
|
283
|
+
"run-commits",
|
|
284
|
+
"correction-rejected",
|
|
285
|
+
"correction-candidate",
|
|
286
|
+
"correction-succeeded",
|
|
281
287
|
]);
|
|
282
288
|
/** The `session` fingerprints on the run's status rows, in row order, each once. */
|
|
283
289
|
export function runChats(rows) {
|