@cbartens/bkit 6.0.0 → 6.1.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 +154 -151
- package/.bkit/core/.agents/context.md +95 -29
- package/.bkit/core/.agents/docs.md +17 -15
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +1 -0
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +6 -5
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-readguard.cjs +1 -0
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-rules.cjs +65 -0
- package/.bkit/core/.agents/rules.md +108 -107
- package/.bkit/core/.agents/skills.md +63 -15
- package/.bkit/core/.bkit/README.md +154 -151
- package/.bkit/core/.bkit/authoring.md +714 -84
- package/.bkit/core/.bkit/cli.md +407 -0
- package/.bkit/core/.bkit/cloud.md +281 -193
- package/.bkit/core/.bkit/comparison.md +43 -41
- package/.bkit/core/.bkit/install.md +154 -84
- package/.bkit/core/.bkit/jsonl.md +193 -130
- package/.bkit/core/.bkit/pipeline.md +114 -114
- package/.bkit/core/.bkit/prompts.md +272 -165
- package/.bkit/core/.bkit/providers.md +457 -271
- package/.bkit/core/.bkit/router.md +69 -0
- package/.bkit/core/.bkit/templates.md +529 -256
- package/.bkit/core/.bkit/trackers.md +80 -52
- package/.bkit/core/.bkit/workflows.md +589 -504
- package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +2 -2
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +3 -3
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +45 -14
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +3 -3
- package/.bkit/core/.codex/hooks/bkit-rules.cjs +57 -0
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +7 -7
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +47 -12
- package/.bkit/core/.opencode/plugin/bkit-rules.js +89 -0
- package/.bkit/core/AGENTS.md +5 -73
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +127 -105
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +104 -70
- package/.bkit/core/docs/templates/bkit-audit-agents.md +94 -72
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +99 -78
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +140 -82
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +98 -72
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +121 -96
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +157 -76
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +113 -71
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +75 -72
- package/.bkit/core/docs/templates/bkit-audit-config.md +122 -76
- package/.bkit/core/docs/templates/bkit-audit-cost.md +85 -74
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +75 -68
- package/.bkit/core/docs/templates/bkit-audit-database.md +101 -70
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +164 -83
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +115 -86
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +264 -88
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +118 -93
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +139 -86
- package/.bkit/core/docs/templates/bkit-audit-failures.md +110 -81
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +99 -74
- package/.bkit/core/docs/templates/bkit-audit-gates.md +105 -77
- package/.bkit/core/docs/templates/bkit-audit-issues.md +104 -80
- package/.bkit/core/docs/templates/bkit-audit-llm.md +131 -58
- package/.bkit/core/docs/templates/bkit-audit-logs.md +123 -100
- package/.bkit/core/docs/templates/bkit-audit-models.md +98 -53
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +56 -52
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +63 -54
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +124 -68
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +95 -70
- package/.bkit/core/docs/templates/bkit-audit-repo.md +169 -73
- package/.bkit/core/docs/templates/bkit-audit-security.md +206 -96
- package/.bkit/core/docs/templates/bkit-audit-slop.md +77 -70
- package/.bkit/core/docs/templates/bkit-audit-testing.md +162 -114
- package/.bkit/core/docs/templates/bkit-audit-usability.md +113 -71
- package/.bkit/core/docs/templates/bkit-plan.md +138 -132
- package/.bkit/core/engine/checks/after/auth.ts +40 -37
- package/.bkit/core/engine/checks/after/ci-yml.ts +65 -2
- package/.bkit/core/engine/checks/after/index.ts +12 -2
- package/.bkit/core/engine/checks/after/tools.ts +80 -33
- package/.bkit/core/engine/checks/before/context-fetch.ts +227 -33
- package/.bkit/core/engine/checks/before/env.ts +1 -1
- package/.bkit/core/engine/checks/before/index.ts +7 -0
- package/.bkit/core/engine/checks/before/repo.ts +40 -0
- package/.bkit/core/engine/checks/status-holes.ts +916 -123
- package/.bkit/core/engine/checks/tips/catalogue.ts +68 -17
- package/.bkit/core/engine/checks/tips/detect.ts +32 -0
- package/.bkit/core/engine/checks/tips/index.ts +47 -6
- package/.bkit/core/engine/cli.ts +238 -84
- package/.bkit/core/engine/commands/analysis.ts +128 -76
- package/.bkit/core/engine/commands/ci/ci.ts +363 -29
- package/.bkit/core/engine/commands/ci/pins.ts +172 -0
- package/.bkit/core/engine/commands/ci/push-gate.ts +223 -0
- package/.bkit/core/engine/commands/install/uninstall.ts +21 -27
- package/.bkit/core/engine/commands/install/upgrade.ts +32 -15
- package/.bkit/core/engine/commands/land.ts +126 -11
- package/.bkit/core/engine/commands/lib.ts +303 -6
- package/.bkit/core/engine/commands/registry.ts +6 -2
- package/.bkit/core/engine/commands/setup/setup.ts +1 -0
- package/.bkit/core/engine/commands/stats.ts +91 -35
- package/.bkit/core/engine/commands/workflow/branches.ts +1477 -117
- package/.bkit/core/engine/commands/workflow/challenge.ts +114 -39
- package/.bkit/core/engine/commands/workflow/completeness.ts +109 -0
- package/.bkit/core/engine/commands/workflow/context.ts +433 -55
- package/.bkit/core/engine/commands/workflow/counters.ts +244 -39
- package/.bkit/core/engine/commands/workflow/decisions.ts +61 -17
- package/.bkit/core/engine/commands/workflow/disk.ts +237 -55
- package/.bkit/core/engine/commands/workflow/fids.ts +19 -1
- package/.bkit/core/engine/commands/workflow/issues.ts +6 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +458 -18
- package/.bkit/core/engine/commands/workflow/locks.ts +2 -0
- package/.bkit/core/engine/commands/workflow/plan-blocks.ts +124 -15
- package/.bkit/core/engine/commands/workflow/plans.ts +257 -0
- package/.bkit/core/engine/commands/workflow/prs.ts +12 -3
- package/.bkit/core/engine/commands/workflow/repo.ts +8 -0
- package/.bkit/core/engine/commands/workflow/roadmap.ts +56 -15
- package/.bkit/core/engine/commands/workflow/run-facts.ts +22 -31
- package/.bkit/core/engine/commands/workflow/runs.ts +652 -34
- package/.bkit/core/engine/commands/workflow/runtime.ts +3 -0
- package/.bkit/core/engine/commands/workflow/skills.ts +1 -0
- package/.bkit/core/engine/commands/workflow/status.ts +200 -17
- package/.bkit/core/engine/commands/workflow/step-table.ts +75 -33
- package/.bkit/core/engine/commands/workflow/steps.ts +635 -24
- package/.bkit/core/engine/commands/workflow/summary-findings.ts +177 -0
- package/.bkit/core/engine/commands/workflow/summary.ts +192 -46
- package/.bkit/core/engine/commands/workflow/tasks.ts +409 -0
- package/.bkit/core/engine/commands/workflow/test-blocks.ts +254 -0
- package/.bkit/core/engine/commands/workflow/tests-changed.ts +201 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +1285 -356
- package/.bkit/core/engine/commands/workflow/workflows.ts +228 -43
- package/.bkit/core/engine/commands/workflow/worktrees.ts +389 -47
- package/.bkit/core/engine/install/cloud-env.ts +251 -121
- package/.bkit/core/engine/install/context-ci-workflow.ts +102 -0
- package/.bkit/core/engine/install/manifest.ts +60 -12
- package/.bkit/core/engine/install/modules/antigravity.ts +3 -2
- package/.bkit/core/engine/install/modules/cloud.ts +3 -3
- package/.bkit/core/engine/install/modules/codex.ts +15 -2
- package/.bkit/core/engine/install/modules/core.ts +956 -52
- package/.bkit/core/engine/install/modules/cursor.ts +6 -6
- package/.bkit/core/engine/install/modules/opencode.ts +16 -4
- package/.bkit/core/engine/install/template-notes.ts +130 -0
- package/.bkit/core/engine/install/version-file.ts +3 -2
- package/.bkit/core/engine/install/write.ts +5 -0
- package/.bkit/core/engine/ledgers/compact.ts +124 -0
- package/.bkit/core/engine/ledgers/journal.ts +291 -0
- package/.bkit/core/engine/ledgers/status.ts +160 -9
- package/.bkit/core/engine/ledgers/telemetry.ts +158 -21
- package/.bkit/core/engine/render/hosts.ts +114 -14
- package/.bkit/core/engine/shared/bkit-latest.ts +26 -4
- package/.bkit/core/engine/shared/dep-updater.ts +60 -0
- package/.bkit/core/engine/shared/egress.ts +1 -1
- package/.bkit/core/engine/shared/package-manager.ts +9 -0
- package/.bkit/core/engine/shared/settings.ts +92 -17
- package/.bkit/core/engine/shared/timeouts.ts +2 -0
- package/.bkit/core/engine/tools/cli-doc.ts +111 -0
- package/.bkit/core/engine/tools/grammar-density.ts +1 -1
- package/.bkit/core/engine/tools/instructions-sources.ts +15 -17
- package/.bkit/core/engine/tools/instructions.ts +94 -43
- package/.bkit/core/hooks/antigravity-hook.js +25 -10
- package/.bkit/core/hooks/gateguard-engine.js +53 -29
- package/.bkit/core/hooks/guardrails-shell.js +4 -4
- package/.bkit/core/hooks/guardrails-tiers.js +3 -3
- package/.bkit/core/hooks/preflight-linear.sh +9 -9
- package/.bkit/core/hooks/preflight-rules.sh +8 -0
- package/.bkit/core/hooks/readguard-engine.js +29 -10
- package/.bkit/core/hooks/session-rules-advisory.js +61 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +187 -116
- package/.bkit/core/prompts/bkit-build-challenge-1.md +56 -37
- package/.bkit/core/prompts/bkit-build-challenge-2.md +65 -45
- package/.bkit/core/prompts/bkit-build-install-skills.md +38 -29
- package/.bkit/core/prompts/bkit-build-plan-convert.md +43 -32
- package/.bkit/core/prompts/bkit-build-plan-current.md +49 -39
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +79 -55
- package/.bkit/core/prompts/bkit-build-plan-tasks.md +149 -0
- package/.bkit/core/prompts/bkit-build-plan-tests.md +120 -0
- package/.bkit/core/prompts/bkit-build-plan-verify.md +87 -50
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +36 -35
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +96 -64
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +54 -45
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +42 -33
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +53 -37
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +35 -30
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +34 -29
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +32 -28
- package/.bkit/core/prompts/bkit-design-generate.md +68 -52
- package/.bkit/core/prompts/bkit-design-organise.md +73 -35
- package/.bkit/core/prompts/bkit-design-review-1.md +58 -54
- package/.bkit/core/prompts/bkit-design-review-2.md +54 -50
- package/.bkit/core/prompts/bkit-design-spike.md +54 -47
- package/.bkit/core/prompts/bkit-design-update.md +42 -31
- package/.bkit/core/prompts/bkit-plan-generate.md +76 -58
- package/.bkit/core/prompts/bkit-plan-review-1.md +63 -49
- package/.bkit/core/prompts/bkit-plan-review-2.md +60 -48
- package/.bkit/core/prompts/bkit-plan-scope-check.md +53 -46
- package/.bkit/core/prompts/bkit-plan-update.md +70 -52
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +82 -50
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +80 -45
- package/.bkit/core/prompts/bkit-ship-update-docs.md +35 -29
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +55 -49
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +76 -49
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +70 -41
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +33 -30
- package/.bkit/core/prompts/bkit-utility-update-failures.md +73 -43
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +77 -50
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +77 -45
- package/.bkit/core/prompts/bkit-utility-update-tracker.md +144 -68
- package/.bkit/core/workflows/bkit-auto.md +53 -30
- package/.bkit/core/workflows/bkit-build.md +635 -304
- package/.bkit/core/workflows/bkit-debug.md +301 -148
- package/.bkit/core/workflows/bkit-design.md +167 -95
- package/.bkit/core/workflows/bkit-plan.md +172 -84
- package/.bkit/core/workflows/bkit-ship.md +299 -152
- package/.bkit/shared/.agents/plugins/bkit/hooks.json +10 -0
- package/.bkit/shared/.claude/bkit-cloud.md +12 -10
- package/.bkit/shared/.claude/settings.json +3 -0
- package/.bkit/shared/.codex/bkit-cloud.md +98 -0
- package/.bkit/shared/.codex/hooks.json +20 -0
- package/.bkit/shared/.cursor/bkit-cloud.md +3 -3
- package/.bkit/shared/.opencode/opencode.json +1 -1
- package/.bkit/shared/CLAUDE.md +5 -1
- package/.bkit/shared/GEMINI.md +4 -1
- package/.bkit/shared/docs/architecture.md +4 -7
- package/.bkit/shared/docs/data-schema.md +4 -7
- package/.bkit/shared/docs/deployments.md +239 -166
- package/.bkit/shared/docs/design.md +11 -12
- package/.bkit/shared/docs/noise.md +8 -7
- package/.bkit/shared/docs/observability.md +5 -8
- package/.bkit/shared/docs/security.md +35 -17
- package/.bkit/shared/docs/setup.md +29 -18
- package/.bkit/shared/docs/technology.md +3 -6
- package/.bkit/shared/docs/testing.md +282 -176
- package/.bkit/shared/gitignore +6 -2
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +15 -16
- package/.bkit/templates/.cursor/Dockerfile +12 -8
- package/.bkit/templates/.cursor/environment.json +1 -1
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +10 -8
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +24 -12
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +3 -3
- package/.bkit/templates/.github/renovate.json5 +34 -6
- package/.bkit/templates/.github/workflows/bkit-ci.yml +53 -50
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +13 -14
- package/.bkit/templates/.github/workflows/bkit-health.yml +97 -0
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +5 -4
- package/.bkit/templates/.github/workflows/bkit-trivy.yml +5 -4
- package/.bkit/templates/.husky/pre-commit +2 -2
- package/.bkit/templates/.husky/pre-push +95 -35
- package/.bkit/templates/.prettierignore +6 -7
- package/.bkit/templates/.vale.ini +27 -27
- package/.bkit/templates/context/bkit-cloudrun.md +23 -15
- package/.bkit/templates/context/bkit-expo.md +70 -52
- package/.bkit/templates/context/bkit-github.md +93 -56
- package/.bkit/templates/context/bkit-inngest.md +21 -15
- package/.bkit/templates/context/bkit-maestro.md +22 -16
- package/.bkit/templates/context/bkit-playwright.md +23 -17
- package/.bkit/templates/context/bkit-resend.md +12 -10
- package/.bkit/templates/context/bkit-sentry.md +30 -20
- package/.bkit/templates/context/bkit-serena.md +8 -7
- package/.bkit/templates/context/bkit-stripe.md +14 -13
- package/.bkit/templates/context/bkit-supabase.md +16 -13
- package/.bkit/templates/context/bkit-tavily.md +14 -11
- package/.bkit/templates/context/bkit-vercel.md +27 -18
- package/.bkit/templates/docs/capabilities.md +15 -14
- package/.bkit/templates/scripts/ci/{check-accepted-divergences.mjs → bkit-check-accepted-divergences.mjs} +6 -3
- package/.bkit/templates/scripts/ci/{check-accepted-divergences.test.mjs → bkit-check-accepted-divergences.test.mjs} +3 -3
- package/.bkit/templates/scripts/ci/{check-capstone.mjs → bkit-check-capstone.mjs} +2 -2
- package/.bkit/templates/scripts/ci/{check-capstone.test.mjs → bkit-check-capstone.test.mjs} +4 -4
- package/.bkit/templates/scripts/ci/{check-dependency-audit.mjs → bkit-check-dependency-audit.mjs} +103 -18
- package/.bkit/templates/scripts/ci/{check-dependency-audit.test.mjs → bkit-check-dependency-audit.test.mjs} +31 -3
- package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +387 -0
- package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +75 -0
- package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +160 -0
- package/.bkit/templates/scripts/ci/lanes/{resolve-push-base.mjs → bkit-resolve-push-base.mjs} +3 -3
- package/.bkit/templates/scripts/ci/lanes/{resolve-push-base.test.mjs → bkit-resolve-push-base.test.mjs} +4 -4
- package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +9 -1
- package/.bkit/templates/scripts/graphify/bkit-graph-drift.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +3 -3
- package/.bkit/templates/scripts/graphify/bkit-graph-embed.py +63 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +2 -2
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +69 -18
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -3
- package/.bkit/templates/scripts/graphify/bkit-graph-surface.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +197 -126
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +64 -41
- package/.bkit/templates/scripts/slop/bkit-slop-type-suppression.mjs +23 -7
- package/.bkit/templates/slop-scan.config.json +9 -2
- package/CHANGELOG.md +119 -0
- package/README.md +250 -76
- package/dist/checks/after/auth.js +36 -33
- package/dist/checks/after/ci-yml.js +52 -2
- package/dist/checks/after/index.js +12 -4
- package/dist/checks/after/tools.js +73 -33
- package/dist/checks/before/context-fetch.js +218 -33
- package/dist/checks/before/env.js +1 -1
- package/dist/checks/before/index.js +6 -2
- package/dist/checks/before/repo.js +35 -1
- package/dist/checks/status-holes.js +739 -114
- package/dist/checks/tips/catalogue.js +59 -17
- package/dist/checks/tips/detect.js +30 -0
- package/dist/checks/tips/index.js +48 -6
- package/dist/cli.js +222 -84
- package/dist/commands/analysis.js +77 -53
- package/dist/commands/ci/ci.js +302 -25
- package/dist/commands/ci/pins.js +142 -0
- package/dist/commands/ci/push-gate.js +194 -0
- package/dist/commands/install/uninstall.js +23 -27
- package/dist/commands/install/upgrade.js +21 -11
- package/dist/commands/land.js +126 -10
- package/dist/commands/lib.js +244 -5
- package/dist/commands/registry.js +6 -2
- package/dist/commands/setup/setup.js +1 -0
- package/dist/commands/stats.js +69 -30
- package/dist/commands/workflow/branches.js +1232 -111
- package/dist/commands/workflow/challenge.js +90 -37
- package/dist/commands/workflow/completeness.js +97 -0
- package/dist/commands/workflow/context.js +371 -51
- package/dist/commands/workflow/counters.js +206 -40
- package/dist/commands/workflow/decisions.js +60 -17
- package/dist/commands/workflow/disk.js +213 -55
- package/dist/commands/workflow/fids.js +18 -1
- package/dist/commands/workflow/issues.js +6 -0
- package/dist/commands/workflow/ledgers.js +372 -21
- package/dist/commands/workflow/locks.js +2 -0
- package/dist/commands/workflow/plan-blocks.js +78 -14
- package/dist/commands/workflow/plans.js +205 -0
- package/dist/commands/workflow/prs.js +12 -3
- package/dist/commands/workflow/repo.js +6 -0
- package/dist/commands/workflow/roadmap.js +50 -17
- package/dist/commands/workflow/run-facts.js +23 -28
- package/dist/commands/workflow/runs.js +530 -33
- package/dist/commands/workflow/runtime.js +3 -0
- package/dist/commands/workflow/skills.js +1 -0
- package/dist/commands/workflow/status.js +166 -19
- package/dist/commands/workflow/step-table.js +61 -29
- package/dist/commands/workflow/steps.js +542 -26
- package/dist/commands/workflow/summary-findings.js +117 -0
- package/dist/commands/workflow/summary.js +154 -41
- package/dist/commands/workflow/tasks.js +378 -0
- package/dist/commands/workflow/test-blocks.js +231 -0
- package/dist/commands/workflow/tests-changed.js +172 -0
- package/dist/commands/workflow/tests.js +1013 -321
- package/dist/commands/workflow/workflows.js +191 -38
- package/dist/commands/workflow/worktrees.js +310 -42
- package/dist/install/cloud-env.js +233 -99
- package/dist/install/context-ci-workflow.js +85 -0
- package/dist/install/manifest.js +57 -12
- package/dist/install/modules/antigravity.js +3 -2
- package/dist/install/modules/cloud.js +3 -3
- package/dist/install/modules/codex.js +12 -2
- package/dist/install/modules/core.js +851 -53
- package/dist/install/modules/cursor.js +6 -6
- package/dist/install/modules/opencode.js +11 -5
- package/dist/install/template-notes.js +116 -0
- package/dist/install/version-file.js +3 -2
- package/dist/ledgers/compact.js +87 -0
- package/dist/ledgers/journal.js +233 -0
- package/dist/ledgers/status.js +115 -5
- package/dist/ledgers/telemetry.js +121 -17
- package/dist/render/hosts.js +100 -14
- package/dist/shared/bkit-latest.js +26 -4
- package/dist/shared/dep-updater.js +49 -0
- package/dist/shared/egress.js +1 -1
- package/dist/shared/package-manager.js +6 -0
- package/dist/shared/settings.js +59 -10
- package/dist/shared/timeouts.js +2 -0
- package/dist/tools/cli-doc.js +97 -0
- package/dist/tools/grammar-density.js +1 -1
- package/dist/tools/instructions-sources.js +15 -16
- package/dist/tools/instructions.js +83 -39
- package/package.json +58 -42
- package/.bkit/core/.bkit/lite.md +0 -73
- package/.bkit/core/engine/commands/workflow/workstreams.ts +0 -172
- package/.bkit/core/prompts/bkit-build-plan-execute.md +0 -124
- package/.bkit/templates/scripts/ci/bkit-local-stack-lock.sh +0 -194
- package/dist/commands/workflow/workstreams.js +0 -149
- /package/.bkit/templates/.vale/styles/{House → Bkit}/Filler.yml +0 -0
- /package/.bkit/templates/.vale/styles/{House → Bkit}/Hedging.yml +0 -0
- /package/.bkit/templates/.vale/styles/{House → Bkit}/LLMSlop.yml +0 -0
- /package/.bkit/templates/.vale/styles/{House → Bkit}/Verbose.yml +0 -0
- /package/.bkit/templates/scripts/ci/{accepted-advisories.json → bkit-accepted-advisories.json} +0 -0
- /package/.bkit/templates/scripts/ci/{accepted-divergences.json → bkit-accepted-divergences.json} +0 -0
- /package/.bkit/templates/scripts/launchd/{launchd.env.example → bkit-launchd.env.example} +0 -0
- /package/.bkit/templates/scripts/launchd/{ai.bkit.launchd.plist → bkit-launchd.plist} +0 -0
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
// name and not "any check".
|
|
22
22
|
import * as fs from "node:fs";
|
|
23
23
|
import * as path from "node:path";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
24
|
+
import { readJsonFile } from "../../shared/json.js";
|
|
25
|
+
import { CI_TIERS, lastRun, statusTimestamp, validateCiSelection, } from "../../ledgers/status.js";
|
|
26
|
+
import { bodySkipToken, commitMessage, CommandError, DEV, EXIT, git, isSharedBranch, parseJson, runGh, runGit, runTool, SKIP_CI_TOKEN, wholeNumber, } from "../lib.js";
|
|
27
|
+
import { ciGeneratedSteps, readBkitConfig } from "../../shared/settings.js";
|
|
27
28
|
import { TIMEOUTS } from "../../shared/timeouts.js";
|
|
28
29
|
import { FID_PATTERNS, fromBranch, fromMarker, issueIdOf, readIssueTracker } from "./fids.js";
|
|
29
30
|
import { AUTO_LABEL, AUTO_ROUTE_SUFFIX } from "./issues.js";
|
|
@@ -32,7 +33,7 @@ import { activeRecord, checkOnlyBookkeeping, retriggerCommit } from "./ledgers.j
|
|
|
32
33
|
import { closeTransportRow, crossCheckFile, devRequiresChecks, prRepoSlug, probePr, } from "./prs.js";
|
|
33
34
|
import { resolveOwnerRepo, splitSlug } from "./repo.js";
|
|
34
35
|
import { restateOutcome } from "./run-facts.js";
|
|
35
|
-
import { extraField, str } from "./status.js";
|
|
36
|
+
import { extraField, readRuns, str } from "./status.js";
|
|
36
37
|
import { writeStepRow } from "./steps.js";
|
|
37
38
|
import { attempt, issueRef, readLabels, trackerTarget } from "./tracker.js";
|
|
38
39
|
const GH_MISSING = "gh is not on PATH — use the mapped GitHub MCP tool instead";
|
|
@@ -62,6 +63,300 @@ export function ciDeclared(root) {
|
|
|
62
63
|
const rel = path.join(".github", "workflows", ciWorkflow);
|
|
63
64
|
return { declared: fs.existsSync(path.join(root, rel)), ciWorkflow, path: rel };
|
|
64
65
|
}
|
|
66
|
+
/** Only the winning reference kind is actionable; a run takes precedence over a PR. */
|
|
67
|
+
export function parseCiReference(input) {
|
|
68
|
+
const references = [];
|
|
69
|
+
const urls = [...input.matchAll(/https:\/\/github\.com\/[^\s<>"`]+/g)].map((match) => match[0].replace(/[),.;\]]+$/, ""));
|
|
70
|
+
const parsed = urls.flatMap((url) => {
|
|
71
|
+
const ref = /^https:\/\/github\.com\/([^/]+\/[^/]+)\/(actions\/runs|pull)\/([^/?#]*)([^?#]*)/.exec(url);
|
|
72
|
+
return ref ? [{ url, ref }] : [];
|
|
73
|
+
});
|
|
74
|
+
const winning = parsed.some(({ ref }) => ref[2] === "actions/runs") ? "actions/runs" : "pull";
|
|
75
|
+
for (const { url, ref } of parsed.filter(({ ref }) => ref[2] === winning)) {
|
|
76
|
+
const id = ref[3];
|
|
77
|
+
const suffix = ref[4];
|
|
78
|
+
const kind = ref[2] === "pull" ? "pr" : "run";
|
|
79
|
+
if (!/^[1-9][0-9]*$/.test(id))
|
|
80
|
+
throw new CommandError(EXIT.USAGE, `invalid ${kind} id in ${url}`);
|
|
81
|
+
let attempt;
|
|
82
|
+
if (kind === "run" && suffix !== "" && suffix !== "/") {
|
|
83
|
+
const pinned = /^\/attempts\/([1-9][0-9]*)\/?$/.exec(suffix);
|
|
84
|
+
if (!pinned || !Number.isSafeInteger(Number(pinned[1])))
|
|
85
|
+
throw new CommandError(EXIT.USAGE, `invalid run attempt in ${url}`);
|
|
86
|
+
attempt = Number(pinned[1]);
|
|
87
|
+
}
|
|
88
|
+
else if (kind === "pr" && suffix !== "" && suffix !== "/")
|
|
89
|
+
continue;
|
|
90
|
+
references.push({ kind, repo: ref[1], id, ...(attempt === undefined ? {} : { attempt }) });
|
|
91
|
+
}
|
|
92
|
+
const kind = references.some((ref) => ref.kind === "run") ? "run" : "pr";
|
|
93
|
+
const winners = [
|
|
94
|
+
...new Map(references.filter((ref) => ref.kind === kind).map((ref) => [JSON.stringify(ref), ref])).values(),
|
|
95
|
+
];
|
|
96
|
+
if (winners.length > 1)
|
|
97
|
+
throw new CommandError(8, `multiple ${kind} references were supplied; name one`);
|
|
98
|
+
return winners[0];
|
|
99
|
+
}
|
|
100
|
+
function selectionHeadRelation(cwd, selection, repo, branch) {
|
|
101
|
+
if (selection.repo.toLowerCase() !== repo.toLowerCase() || selection.headBranch !== branch) {
|
|
102
|
+
throw new CommandError(82, `selected evidence belongs to ${selection.repo} branch ${selection.headBranch}; adopted ${repo} branch ${branch}. Supply branch=${selection.headBranch} in its checkout`);
|
|
103
|
+
}
|
|
104
|
+
const head = git(cwd, ["rev-parse", "--verify", `refs/heads/${branch}^{commit}`]);
|
|
105
|
+
if (head === selection.headSha)
|
|
106
|
+
return "current";
|
|
107
|
+
if (head === null || !runGit(cwd, ["cat-file", "-e", `${selection.headSha}^{commit}`]).ok) {
|
|
108
|
+
throw new CommandError(82, `selected commit ${selection.headSha} or branch ${branch} is unavailable; ancestry is unknown`);
|
|
109
|
+
}
|
|
110
|
+
const relation = runTool("git", ["merge-base", "--is-ancestor", selection.headSha, head], cwd);
|
|
111
|
+
if (relation.status === 0)
|
|
112
|
+
return "ancestor";
|
|
113
|
+
throw new CommandError(82, relation.status === 1
|
|
114
|
+
? `selected commit ${selection.headSha} is divergent from ${branch}`
|
|
115
|
+
: `ancestry of ${selection.headSha} is unknown: ${relation.stderr}`);
|
|
116
|
+
}
|
|
117
|
+
function locateCi(ctx) {
|
|
118
|
+
const f = ctx.flags;
|
|
119
|
+
const repo = String(f.repo);
|
|
120
|
+
const branch = String(f.branch);
|
|
121
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(repo) ||
|
|
122
|
+
!runGit(ctx.cwd, ["check-ref-format", "--branch", branch]).ok) {
|
|
123
|
+
throw new CommandError(EXIT.USAGE, "--repo and --branch must name a repository and a valid branch");
|
|
124
|
+
}
|
|
125
|
+
const readInput = (flag) => f[flag] === undefined ? "" : fs.readFileSync(path.resolve(ctx.cwd, String(f[flag])), "utf8");
|
|
126
|
+
const prompt = readInput("promptFile");
|
|
127
|
+
const selectionFile = path.resolve(ctx.cwd, String(f.selectionOut));
|
|
128
|
+
const finish = (selection, failedJobs = []) => {
|
|
129
|
+
if (!validateCiSelection(selection))
|
|
130
|
+
throw new CommandError(82, "selected evidence has malformed or missing identity fields");
|
|
131
|
+
const headRelation = selection.mode === "ci" ? selectionHeadRelation(ctx.cwd, selection, repo, branch) : null;
|
|
132
|
+
if (headRelation === "ancestor")
|
|
133
|
+
ctx.log(`selected run ${selection.mode === "ci" ? selection.runId : ""} is historical ancestor evidence; inspect intervening changes before fixing`);
|
|
134
|
+
fs.mkdirSync(path.dirname(selectionFile), { recursive: true });
|
|
135
|
+
fs.writeFileSync(selectionFile, `${JSON.stringify(selection, null, 2)}\n`);
|
|
136
|
+
ctx.emit({
|
|
137
|
+
selection: selection.mode,
|
|
138
|
+
runId: selection.mode === "ci" ? selection.runId : null,
|
|
139
|
+
runUrl: selection.mode === "ci" ? selection.runUrl : null,
|
|
140
|
+
runAttempt: selection.mode === "ci" ? selection.runAttempt : null,
|
|
141
|
+
workflowId: selection.mode === "ci" ? selection.workflowId : null,
|
|
142
|
+
workflowPath: selection.mode === "ci" ? selection.workflowPath : null,
|
|
143
|
+
headSha: selection.mode === "ci" ? selection.headSha : null,
|
|
144
|
+
headRelation,
|
|
145
|
+
failedJobs,
|
|
146
|
+
tiers: selection.mode === "ci" ? selection.redTiers : [],
|
|
147
|
+
via: selection.mode === "ci" ? selection.via : null,
|
|
148
|
+
reason: selection.mode === "local" ? selection.reason : null,
|
|
149
|
+
selectionFile,
|
|
150
|
+
});
|
|
151
|
+
return selection.mode === "ci" ? EXIT.OK : 1;
|
|
152
|
+
};
|
|
153
|
+
if (/\[local\]/i.test(prompt))
|
|
154
|
+
return finish({ mode: "local", reason: "explicit-local" });
|
|
155
|
+
let reference = parseCiReference(prompt);
|
|
156
|
+
let via = reference ? `prompt-${reference.kind}` : "branch";
|
|
157
|
+
let saved;
|
|
158
|
+
if (!reference && f.file !== undefined && fs.existsSync(path.resolve(ctx.cwd, String(f.file)))) {
|
|
159
|
+
const active = lastRun(readRuns(path.resolve(ctx.cwd, String(f.file))), "debug");
|
|
160
|
+
if (active?.status === "IN_PROGRESS" && active.ciSelection !== undefined) {
|
|
161
|
+
if (!validateCiSelection(active.ciSelection))
|
|
162
|
+
throw new CommandError(82, "active saved CI selection is invalid");
|
|
163
|
+
saved = active.ciSelection;
|
|
164
|
+
if (saved.mode === "local")
|
|
165
|
+
return finish(saved);
|
|
166
|
+
reference = { kind: "run", repo: saved.repo, id: saved.runId, attempt: saved.runAttempt };
|
|
167
|
+
via = saved.via;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (!reference) {
|
|
171
|
+
const issue = readInput("issueTextFile");
|
|
172
|
+
// issues text already removes generated comments; refuse a raw generated payload too.
|
|
173
|
+
reference = parseCiReference(/^######\s+bkit:generated/m.test(issue) ? "" : issue);
|
|
174
|
+
if (reference)
|
|
175
|
+
via = `issue-${reference.kind}`;
|
|
176
|
+
}
|
|
177
|
+
if (reference && reference.repo.toLowerCase() !== repo.toLowerCase())
|
|
178
|
+
throw new CommandError(82, `reference repository ${reference.repo} does not match adopted repository ${repo}`);
|
|
179
|
+
const declared = ciDeclared(checkoutRoot(ctx.cwd));
|
|
180
|
+
if (!reference && !declared.declared)
|
|
181
|
+
return finish({ mode: "local", reason: "no-configured-ci" });
|
|
182
|
+
const api = (endpoint, extra = []) => {
|
|
183
|
+
const response = runGh(ctx.cwd, ["api", endpoint, ...extra]);
|
|
184
|
+
if (!response.ok)
|
|
185
|
+
throw new CommandError(/HTTP 404/.test(response.stderr) ? 82 : EXIT.USE_MCP, `CI evidence unavailable: ${response.stderr || GH_MISSING}`);
|
|
186
|
+
const parsed = jsonOrUndefined(response.stdout);
|
|
187
|
+
if (parsed === undefined)
|
|
188
|
+
throw new CommandError(82, "CI evidence response is malformed");
|
|
189
|
+
return parsed;
|
|
190
|
+
};
|
|
191
|
+
const validateRun = (candidate) => {
|
|
192
|
+
const base = {
|
|
193
|
+
mode: "ci",
|
|
194
|
+
provider: "github",
|
|
195
|
+
repo,
|
|
196
|
+
runId: String(candidate.id),
|
|
197
|
+
runAttempt: Number(candidate.run_attempt),
|
|
198
|
+
runUrl: `https://github.com/${repo}/actions/runs/${candidate.id}/attempts/${candidate.run_attempt}`,
|
|
199
|
+
workflowId: String(candidate.workflow_id ?? ""),
|
|
200
|
+
workflowPath: text(candidate.path),
|
|
201
|
+
headBranch: text(candidate.head_branch),
|
|
202
|
+
headSha: text(candidate.head_sha),
|
|
203
|
+
conclusion: "failure",
|
|
204
|
+
redTiers: [],
|
|
205
|
+
via,
|
|
206
|
+
};
|
|
207
|
+
if (!validateCiSelection(base) ||
|
|
208
|
+
text(obj(candidate.repository).full_name).toLowerCase() !== repo.toLowerCase() ||
|
|
209
|
+
text(obj(candidate.head_repository).full_name).toLowerCase() !== repo.toLowerCase())
|
|
210
|
+
throw new CommandError(82, "run identity, repository or fork metadata is incomplete or mismatched");
|
|
211
|
+
if (candidate.head_branch !== branch)
|
|
212
|
+
throw new CommandError(82, `run branch ${text(candidate.head_branch)} differs from adopted branch ${branch}; supply branch=${text(candidate.head_branch)} in its checkout`);
|
|
213
|
+
if (reference?.kind !== "run" && candidate.path !== declared.path)
|
|
214
|
+
throw new CommandError(82, "discovered run does not belong to the configured workflow");
|
|
215
|
+
};
|
|
216
|
+
let run;
|
|
217
|
+
let jobs;
|
|
218
|
+
const requested = { repo, branch, kind: reference?.kind ?? "branch" };
|
|
219
|
+
if (reference?.kind === "run") {
|
|
220
|
+
requested.runId = reference.id;
|
|
221
|
+
if (reference.attempt !== undefined)
|
|
222
|
+
requested.runAttempt = reference.attempt;
|
|
223
|
+
}
|
|
224
|
+
else if (reference?.kind === "pr")
|
|
225
|
+
requested.pr = reference.id;
|
|
226
|
+
else
|
|
227
|
+
requested.workflow = declared.ciWorkflow;
|
|
228
|
+
if (f.evidenceFile !== undefined) {
|
|
229
|
+
const envelope = obj(jsonOrUndefined(readInput("evidenceFile")));
|
|
230
|
+
const request = obj(envelope.request);
|
|
231
|
+
if (envelope.complete !== true ||
|
|
232
|
+
!Object.entries(requested).every(([key, value]) => request[key] === value))
|
|
233
|
+
throw new CommandError(82, "fallback evidence is incomplete or its request identity differs");
|
|
234
|
+
if (envelope.noRed === true &&
|
|
235
|
+
!reference &&
|
|
236
|
+
typeof request.headSha === "string" &&
|
|
237
|
+
request.headSha === git(ctx.cwd, ["rev-parse", "HEAD"]))
|
|
238
|
+
return finish({ mode: "local", reason: "automatic-no-red" });
|
|
239
|
+
run = obj(envelope.run);
|
|
240
|
+
if (reference?.kind === "pr") {
|
|
241
|
+
const head = obj(obj(envelope.pr).head);
|
|
242
|
+
if (head.ref !== branch ||
|
|
243
|
+
head.sha !== run.head_sha ||
|
|
244
|
+
text(obj(head.repo).full_name).toLowerCase() !== repo.toLowerCase())
|
|
245
|
+
throw new CommandError(82, "fallback PR head is missing or differs from the selected run");
|
|
246
|
+
}
|
|
247
|
+
if (!Array.isArray(envelope.jobs) || envelope.jobs.some((job) => obj(job).id === undefined))
|
|
248
|
+
throw new CommandError(82, "fallback jobs are incomplete");
|
|
249
|
+
jobs = envelope.jobs.map(obj);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
let expectedHead;
|
|
253
|
+
if (reference?.kind === "pr") {
|
|
254
|
+
const pr = obj(api(`/repos/${repo}/pulls/${reference.id}`));
|
|
255
|
+
const head = obj(pr.head);
|
|
256
|
+
if (text(obj(head.repo).full_name).toLowerCase() !== repo.toLowerCase() ||
|
|
257
|
+
head.ref !== branch ||
|
|
258
|
+
!/^[0-9a-f]{40,64}$/.test(text(head.sha)))
|
|
259
|
+
throw new CommandError(82, `PR head does not match adopted ${repo} branch ${branch}; inspect its branch and fork repository`);
|
|
260
|
+
expectedHead = text(head.sha);
|
|
261
|
+
}
|
|
262
|
+
if (reference?.kind === "run") {
|
|
263
|
+
run = obj(api(`/repos/${repo}/actions/runs/${reference.id}${reference.attempt === undefined ? "" : `/attempts/${reference.attempt}`}`));
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
const response = obj(api(`/repos/${repo}/actions/workflows/${queryValue(declared.ciWorkflow)}/runs?branch=${queryValue(branch)}&status=completed&per_page=100${expectedHead ? `&head_sha=${expectedHead}` : ""}`));
|
|
267
|
+
if (!Array.isArray(response.workflow_runs) ||
|
|
268
|
+
!Number.isSafeInteger(response.total_count) ||
|
|
269
|
+
Number(response.total_count) < 0 ||
|
|
270
|
+
Number(response.total_count) < response.workflow_runs.length)
|
|
271
|
+
throw new CommandError(82, "workflow lookup returned an incomplete response");
|
|
272
|
+
const candidates = response.workflow_runs
|
|
273
|
+
.map(obj)
|
|
274
|
+
.filter((candidate) => candidate.status === "completed");
|
|
275
|
+
run =
|
|
276
|
+
candidates.sort((a, b) => text(b.created_at).localeCompare(text(a.created_at)) || Number(b.id) - Number(a.id))[0] ?? {};
|
|
277
|
+
if (Object.keys(run).length === 0) {
|
|
278
|
+
if (Number(response.total_count) > 0)
|
|
279
|
+
throw new CommandError(82, "workflow lookup returned no completed records despite a nonempty result");
|
|
280
|
+
if (reference)
|
|
281
|
+
throw new CommandError(82, "named PR has no completed red run; choose [local] to discover locally");
|
|
282
|
+
return finish({ mode: "local", reason: "automatic-no-red" });
|
|
283
|
+
}
|
|
284
|
+
if (expectedHead && run.head_sha !== expectedHead)
|
|
285
|
+
throw new CommandError(82, "PR lookup returned a run from another head");
|
|
286
|
+
}
|
|
287
|
+
validateRun(run);
|
|
288
|
+
if (run.status !== "completed" ||
|
|
289
|
+
!["failure", "timed_out", "startup_failure"].includes(text(run.conclusion))) {
|
|
290
|
+
if (reference)
|
|
291
|
+
throw new CommandError(82, `named evidence is ${text(run.status)}/${text(run.conclusion)}; choose [local] to discover locally`);
|
|
292
|
+
if (run.status !== "completed" ||
|
|
293
|
+
!["success", "cancelled", "skipped", "neutral", "action_required", "stale"].includes(text(run.conclusion)))
|
|
294
|
+
throw new CommandError(82, "workflow run has an invalid state");
|
|
295
|
+
return finish({ mode: "local", reason: "automatic-no-red" });
|
|
296
|
+
}
|
|
297
|
+
const attempt = reference?.attempt ?? Number(run.run_attempt);
|
|
298
|
+
if (!Number.isSafeInteger(attempt) || attempt <= 0 || !/^[1-9][0-9]*$/.test(String(run.id)))
|
|
299
|
+
throw new CommandError(82, "run identity or attempt is missing");
|
|
300
|
+
const pages = api(`/repos/${repo}/actions/runs/${run.id}/attempts/${attempt}/jobs?per_page=100`, ["--paginate", "--slurp"]);
|
|
301
|
+
if (!Array.isArray(pages) || pages.length === 0)
|
|
302
|
+
throw new CommandError(82, "job pagination returned no complete pages");
|
|
303
|
+
const total = obj(pages[0]).total_count;
|
|
304
|
+
if (!Number.isSafeInteger(total) ||
|
|
305
|
+
Number(total) < 0 ||
|
|
306
|
+
pages.some((page) => !Array.isArray(obj(page).jobs) || obj(page).total_count !== total))
|
|
307
|
+
throw new CommandError(82, "job pagination returned incomplete pages");
|
|
308
|
+
jobs = pages.flatMap((page) => arr(obj(page).jobs).map(obj));
|
|
309
|
+
if (jobs.length !== total ||
|
|
310
|
+
new Set(jobs.map((job) => job.id)).size !== total ||
|
|
311
|
+
jobs.some((job) => !Number.isSafeInteger(job.id) ||
|
|
312
|
+
typeof job.name !== "string" ||
|
|
313
|
+
typeof job.conclusion !== "string"))
|
|
314
|
+
throw new CommandError(82, "job pagination did not return every job");
|
|
315
|
+
}
|
|
316
|
+
const attempt = reference?.attempt ?? Number(run.run_attempt);
|
|
317
|
+
validateRun(run);
|
|
318
|
+
if (jobs.some((job) => !Number.isSafeInteger(job.id) ||
|
|
319
|
+
typeof job.name !== "string" ||
|
|
320
|
+
job.name.length === 0 ||
|
|
321
|
+
typeof job.conclusion !== "string") ||
|
|
322
|
+
new Set(jobs.map((job) => job.id)).size !== jobs.length)
|
|
323
|
+
throw new CommandError(82, "job identities or conclusions are incomplete");
|
|
324
|
+
if (reference?.kind === "run" && String(run.id) !== reference.id)
|
|
325
|
+
throw new CommandError(82, "selected run differs from the requested run");
|
|
326
|
+
if (Number(run.run_attempt) !== attempt ||
|
|
327
|
+
run.status !== "completed" ||
|
|
328
|
+
text(obj(run.repository).full_name).toLowerCase() !== repo.toLowerCase() ||
|
|
329
|
+
text(obj(run.head_repository).full_name).toLowerCase() !== repo.toLowerCase())
|
|
330
|
+
throw new CommandError(82, "run attempt, repository or fork identity does not match");
|
|
331
|
+
const failedJobs = jobs.filter((job) => ["failure", "timed_out", "startup_failure"].includes(text(job.conclusion)));
|
|
332
|
+
const mapped = failedJobs
|
|
333
|
+
.filter((job) => job.name !== "bkit-tests-check")
|
|
334
|
+
.map((job) => /^bkit-tests-(static|unit|integration|e2e|live|migration)$/.exec(text(job.name))?.[1]);
|
|
335
|
+
const tiers = mapped.some((tier) => tier === undefined)
|
|
336
|
+
? []
|
|
337
|
+
: CI_TIERS.filter((tier) => mapped.includes(tier));
|
|
338
|
+
const selection = {
|
|
339
|
+
mode: "ci",
|
|
340
|
+
provider: "github",
|
|
341
|
+
repo,
|
|
342
|
+
runId: String(run.id),
|
|
343
|
+
runAttempt: attempt,
|
|
344
|
+
runUrl: `https://github.com/${repo}/actions/runs/${run.id}/attempts/${attempt}`,
|
|
345
|
+
workflowId: String(run.workflow_id ?? ""),
|
|
346
|
+
workflowPath: text(run.path),
|
|
347
|
+
headBranch: text(run.head_branch),
|
|
348
|
+
headSha: text(run.head_sha),
|
|
349
|
+
conclusion: text(run.conclusion),
|
|
350
|
+
redTiers: tiers,
|
|
351
|
+
via,
|
|
352
|
+
};
|
|
353
|
+
if (saved?.mode === "ci" &&
|
|
354
|
+
(saved.workflowId !== selection.workflowId ||
|
|
355
|
+
saved.headSha !== selection.headSha ||
|
|
356
|
+
saved.workflowPath !== selection.workflowPath))
|
|
357
|
+
throw new CommandError(82, "saved evidence identity differs from the returned run");
|
|
358
|
+
return finish(selection, failedJobs);
|
|
359
|
+
}
|
|
65
360
|
/** Skip-token scan of a landed commit's body (see `bodySkipToken`). */
|
|
66
361
|
export function scanBody(cwd, sha) {
|
|
67
362
|
const token = bodySkipToken(cwd, sha);
|
|
@@ -182,15 +477,17 @@ function currentPr(cwd, gh) {
|
|
|
182
477
|
}
|
|
183
478
|
/** Exit code: the re-trigger commit or its push failed. */
|
|
184
479
|
export const EXIT_RETRIGGER_FAILED = 6;
|
|
480
|
+
/** Push the current branch; the failure text is kept so the gate can name why. */
|
|
185
481
|
function pushCurrentBranch(cwd) {
|
|
186
482
|
const branch = git(cwd, ["branch", "--show-current"]);
|
|
187
483
|
if (!branch)
|
|
188
|
-
return false;
|
|
484
|
+
return { ok: false, error: "no branch checked out (detached HEAD)" };
|
|
189
485
|
// Shared branches never force; a feature branch is rewritten only by this run.
|
|
190
486
|
const args = isSharedBranch(branch)
|
|
191
487
|
? ["push", "origin", branch]
|
|
192
488
|
: ["push", "--force-with-lease", "origin", branch];
|
|
193
|
-
|
|
489
|
+
const res = runGit(cwd, args);
|
|
490
|
+
return { ok: res.ok, error: res.ok ? "" : res.stderr || res.stdout };
|
|
194
491
|
}
|
|
195
492
|
/**
|
|
196
493
|
* The CI-Dispatch Gate after build / debug's last push. Never pushes after the
|
|
@@ -298,10 +595,26 @@ export async function ciDispatchGate(o, deps) {
|
|
|
298
595
|
return res;
|
|
299
596
|
}
|
|
300
597
|
let pushed;
|
|
598
|
+
let failure = "";
|
|
301
599
|
if (rec === null) {
|
|
302
600
|
landed = null;
|
|
303
|
-
|
|
304
|
-
|
|
601
|
+
const before = git(o.cwd, ["rev-parse", "HEAD"]);
|
|
602
|
+
const made = runGit(o.cwd, ["commit", "--allow-empty", "-m", message]);
|
|
603
|
+
if (!made.ok) {
|
|
604
|
+
pushed = false;
|
|
605
|
+
failure = made.stderr || made.stdout;
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
const push = pushCurrentBranch(o.cwd);
|
|
609
|
+
pushed = push.ok;
|
|
610
|
+
if (!push.ok) {
|
|
611
|
+
failure = push.error;
|
|
612
|
+
// The commit never reached the remote: drop it so a re-run does not pile
|
|
613
|
+
// up orphan re-triggers. --soft restores the index exactly as the commit left it.
|
|
614
|
+
if (before !== null)
|
|
615
|
+
runGit(o.cwd, ["reset", "--soft", before]);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
305
618
|
}
|
|
306
619
|
else {
|
|
307
620
|
const made = retriggerCommit(o.cwd, rec, message);
|
|
@@ -316,7 +629,7 @@ export async function ciDispatchGate(o, deps) {
|
|
|
316
629
|
fetchLanded();
|
|
317
630
|
}
|
|
318
631
|
if (!pushed) {
|
|
319
|
-
deps.log(
|
|
632
|
+
deps.log(`re-trigger commit or push failed${failure ? `: ${failure}` : ""} — no verdict; route to the Failure Path`);
|
|
320
633
|
res.phase = "repoll";
|
|
321
634
|
res.handoff = EXIT_RETRIGGER_FAILED;
|
|
322
635
|
return res;
|
|
@@ -366,7 +679,7 @@ export const GATE = {
|
|
|
366
679
|
SUPERSEDED: 14,
|
|
367
680
|
/** The selected run was cancelled. */
|
|
368
681
|
CANCELLED: 15,
|
|
369
|
-
/** A lane named in bkit.testing.
|
|
682
|
+
/** A lane named in bkit.testing.ciRequired concluded skipped. */
|
|
370
683
|
LANE_SKIPPED: 16,
|
|
371
684
|
/** --validated is not an ancestor of the head plus bookkeeping-only commits. */
|
|
372
685
|
NOT_BOOKKEEPING: 17,
|
|
@@ -395,6 +708,28 @@ export function onlyBookkeeping(root, o) {
|
|
|
395
708
|
};
|
|
396
709
|
}
|
|
397
710
|
}
|
|
711
|
+
/** Job and step conclusions that are not a failure. */
|
|
712
|
+
const NOT_FAILED = new Set(["success", "skipped", "neutral"]);
|
|
713
|
+
/**
|
|
714
|
+
* The failed steps of a run's jobs as `{job}/{step}`, the capstone left out: it fails
|
|
715
|
+
* only because another job did. A job that did not pass with no step that failed (a
|
|
716
|
+
* runner or setup failure) is `{job}/`, which no list entry matches.
|
|
717
|
+
*/
|
|
718
|
+
export function failedStepsOf(jobs, capstone) {
|
|
719
|
+
const out = [];
|
|
720
|
+
for (const job of jobs) {
|
|
721
|
+
const name = text(job.name);
|
|
722
|
+
if (name === capstone || NOT_FAILED.has(text(job.conclusion)))
|
|
723
|
+
continue;
|
|
724
|
+
const steps = arr(job.steps)
|
|
725
|
+
.map(obj)
|
|
726
|
+
.filter((st) => st.conclusion !== null && st.conclusion !== undefined)
|
|
727
|
+
.filter((st) => !NOT_FAILED.has(text(st.conclusion)))
|
|
728
|
+
.map((st) => `${name}/${text(st.name)}`);
|
|
729
|
+
out.push(...(steps.length > 0 ? steps : [`${name}/`]));
|
|
730
|
+
}
|
|
731
|
+
return out;
|
|
732
|
+
}
|
|
398
733
|
const toRun = (v) => {
|
|
399
734
|
const r = obj(v);
|
|
400
735
|
return {
|
|
@@ -430,9 +765,11 @@ export function shipGate(o, gh, log) {
|
|
|
430
765
|
repo: o.repo || null,
|
|
431
766
|
skippedLanes: [],
|
|
432
767
|
nonBookkeepingPaths: [],
|
|
768
|
+
failedSteps: [],
|
|
769
|
+
regenerable: false,
|
|
433
770
|
reason: "",
|
|
434
771
|
};
|
|
435
|
-
const requiredLanes = cfg.
|
|
772
|
+
const requiredLanes = cfg.ciRequired;
|
|
436
773
|
const refuse = (code, reason, runUrl) => {
|
|
437
774
|
log(reason);
|
|
438
775
|
log(`required head: ${r.head}`);
|
|
@@ -500,9 +837,9 @@ export function shipGate(o, gh, log) {
|
|
|
500
837
|
log(GH_MISSING);
|
|
501
838
|
return r;
|
|
502
839
|
};
|
|
503
|
-
/** The run's jobs
|
|
504
|
-
*
|
|
505
|
-
const
|
|
840
|
+
/** The run's jobs. `--slurp` turns --paginate's one-document-per-page stream into one
|
|
841
|
+
* array; without it a run with more than 100 jobs hides every page but the first. */
|
|
842
|
+
const listJobs = (run) => {
|
|
506
843
|
const jobsRes = gh([
|
|
507
844
|
"api",
|
|
508
845
|
`/repos/${r.repo}/actions/runs/${run.id}/jobs`,
|
|
@@ -510,16 +847,43 @@ export function shipGate(o, gh, log) {
|
|
|
510
847
|
"--slurp",
|
|
511
848
|
]);
|
|
512
849
|
if (jobsRes.missing)
|
|
850
|
+
return "missing";
|
|
851
|
+
if (!jobsRes.ok)
|
|
852
|
+
return "api-error";
|
|
853
|
+
const jobsJson = jsonOrUndefined(jobsRes.stdout);
|
|
854
|
+
if (jobsJson === undefined)
|
|
855
|
+
return "invalid";
|
|
856
|
+
const pages = Array.isArray(jobsJson) ? jobsJson : [jobsJson];
|
|
857
|
+
return pages.flatMap((p) => arr(obj(p).jobs).map(obj));
|
|
858
|
+
};
|
|
859
|
+
/** The run's jobs, or the refusal. */
|
|
860
|
+
const readJobs = (run) => {
|
|
861
|
+
const jobs = listJobs(run);
|
|
862
|
+
if (jobs === "missing")
|
|
513
863
|
return ghMissing();
|
|
514
|
-
if (
|
|
864
|
+
if (jobs === "api-error") {
|
|
515
865
|
return apiError(`jobs query failed for run ${run.id} — API error (distinct from 'no capstone')`, run.html_url);
|
|
516
866
|
}
|
|
517
|
-
|
|
518
|
-
if (jobsJson === undefined) {
|
|
867
|
+
if (jobs === "invalid") {
|
|
519
868
|
return refuse(GATE.API_ERROR, `jobs response for run ${run.id} is not valid JSON`, run.html_url);
|
|
520
869
|
}
|
|
521
|
-
|
|
522
|
-
|
|
870
|
+
return jobs;
|
|
871
|
+
};
|
|
872
|
+
/** A failed run's failed steps, and whether `bkit:generate` fixes each one. Jobs that
|
|
873
|
+
* cannot be read leave it unregenerable; the refusal itself does not change. */
|
|
874
|
+
const classifyFailure = (run) => {
|
|
875
|
+
const jobs = listJobs(run);
|
|
876
|
+
if (!Array.isArray(jobs)) {
|
|
877
|
+
log(`failed steps unknown: the jobs of run ${run.id} could not be read`);
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
r.failedSteps = failedStepsOf(jobs, r.capstone);
|
|
881
|
+
const fixable = ciGeneratedSteps(cfg);
|
|
882
|
+
r.regenerable = r.failedSteps.length > 0 && r.failedSteps.every((st) => fixable.includes(st));
|
|
883
|
+
for (const st of r.failedSteps)
|
|
884
|
+
log(`failed step: ${st}`);
|
|
885
|
+
if (r.regenerable)
|
|
886
|
+
log("every failed step is one bkit:generate fixes (bkit.testing.ciGenerated)");
|
|
523
887
|
};
|
|
524
888
|
/** Capstone-only verdict: the capstone job's own result, whatever the run and its other jobs did. */
|
|
525
889
|
const capstoneVerdict = (run) => {
|
|
@@ -633,6 +997,7 @@ export function shipGate(o, gh, log) {
|
|
|
633
997
|
if (o.capstoneOnly)
|
|
634
998
|
return capstoneVerdict(selected);
|
|
635
999
|
if (selected.conclusion === "failure") {
|
|
1000
|
+
classifyFailure(selected);
|
|
636
1001
|
return refuse(GATE.FAILED, `selected run concluded FAILURE at head ${r.head}`, url);
|
|
637
1002
|
}
|
|
638
1003
|
if (selected.conclusion === "cancelled") {
|
|
@@ -664,7 +1029,7 @@ export function shipGate(o, gh, log) {
|
|
|
664
1029
|
log(`note: capstone '${r.capstone}' is green and owns the planned-vs-vacuous judgement for those lanes`);
|
|
665
1030
|
const required = r.skippedLanes.filter((l) => requiredLanes.includes(l));
|
|
666
1031
|
if (required.length) {
|
|
667
|
-
log(`declared in bkit.testing.
|
|
1032
|
+
log(`declared in bkit.testing.ciRequired: ${requiredLanes.join(",")}`);
|
|
668
1033
|
return refuse(GATE.LANE_SKIPPED, `required lane(s) concluded 'skipped' at head ${r.head} — vacuous green: ${required.join(", ")}`, url);
|
|
669
1034
|
}
|
|
670
1035
|
}
|
|
@@ -766,15 +1131,6 @@ export const EXIT_TRIGGER_FAILED = 5;
|
|
|
766
1131
|
export const EXIT_SKIP_TOKEN = 4;
|
|
767
1132
|
/** Exit code: the pushed head's commit message could not be read for the body scan. */
|
|
768
1133
|
export const EXIT_SCAN_ERROR = 5;
|
|
769
|
-
const wholeNumber = (v, flag, fallback, min = 0) => {
|
|
770
|
-
if (v === undefined)
|
|
771
|
-
return fallback;
|
|
772
|
-
const s = String(v);
|
|
773
|
-
if (!/^[0-9]+$/.test(s) || Number(s) < min) {
|
|
774
|
-
throw new CommandError(EXIT.USAGE, `--${flag} takes a whole number >= ${min} (got "${s}")`);
|
|
775
|
-
}
|
|
776
|
-
return Number(s);
|
|
777
|
-
};
|
|
778
1134
|
const HEAD_FLAG = { name: "head", type: "string", help: "commit SHA" };
|
|
779
1135
|
const REPO_FLAG = {
|
|
780
1136
|
name: "repo",
|
|
@@ -967,11 +1323,12 @@ async function runDispatch(ctx) {
|
|
|
967
1323
|
if ((file === undefined) !== (step === undefined))
|
|
968
1324
|
throw new CommandError(EXIT.USAGE, "--file and --step go together");
|
|
969
1325
|
let row = null;
|
|
1326
|
+
let progressLine;
|
|
970
1327
|
let transport = null;
|
|
971
1328
|
const code = dispatchCode(r, pr, scanResult, ctx.log);
|
|
972
1329
|
if (file !== undefined && r.ciDispatch !== null) {
|
|
973
1330
|
const status = path.resolve(ctx.cwd, file);
|
|
974
|
-
|
|
1331
|
+
const written = writeStepRow(ctx.cwd, {
|
|
975
1332
|
file: status,
|
|
976
1333
|
workflow: String(f.workflow ?? "build"),
|
|
977
1334
|
step: step,
|
|
@@ -981,7 +1338,9 @@ async function runDispatch(ctx) {
|
|
|
981
1338
|
ciDispatch: r.ciDispatch,
|
|
982
1339
|
},
|
|
983
1340
|
commit: "none",
|
|
984
|
-
}, ctx.log)
|
|
1341
|
+
}, ctx.log);
|
|
1342
|
+
row = written.row;
|
|
1343
|
+
progressLine = written.progressLine;
|
|
985
1344
|
if (/-close-workflow$/.test(step)) {
|
|
986
1345
|
const tree = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
|
|
987
1346
|
restateOutcome(tree, status, String(f.workflow ?? "build"), { ...r.ciDispatch }, ctx.log);
|
|
@@ -1001,6 +1360,7 @@ async function runDispatch(ctx) {
|
|
|
1001
1360
|
ciWorkflow: r.ciWorkflow,
|
|
1002
1361
|
row,
|
|
1003
1362
|
transport,
|
|
1363
|
+
...(progressLine === undefined ? {} : { progressLine }),
|
|
1004
1364
|
});
|
|
1005
1365
|
return EXIT.NO;
|
|
1006
1366
|
}
|
|
@@ -1022,6 +1382,7 @@ async function runDispatch(ctx) {
|
|
|
1022
1382
|
ciWorkflow: r.ciWorkflow,
|
|
1023
1383
|
row,
|
|
1024
1384
|
transport,
|
|
1385
|
+
...(progressLine === undefined ? {} : { progressLine }),
|
|
1025
1386
|
});
|
|
1026
1387
|
return code;
|
|
1027
1388
|
}
|
|
@@ -1077,6 +1438,14 @@ function logResolvedPrRepo(repoFlag, prNumber, pr, log) {
|
|
|
1077
1438
|
}
|
|
1078
1439
|
function runGate(ctx) {
|
|
1079
1440
|
const f = ctx.flags;
|
|
1441
|
+
let selection;
|
|
1442
|
+
const selectionFile = str(f.ciSelectionFile);
|
|
1443
|
+
if (selectionFile !== undefined) {
|
|
1444
|
+
const parsed = readJsonFile(path.resolve(ctx.cwd, selectionFile));
|
|
1445
|
+
if (!parsed.ok || !validateCiSelection(parsed.value))
|
|
1446
|
+
throw new CommandError(EXIT.USAGE, "cannot read validated CI selection: unreadable JSON or invalid selection");
|
|
1447
|
+
selection = parsed.value;
|
|
1448
|
+
}
|
|
1080
1449
|
const given = [f.head, f.pr, f.squashOf].filter((v) => v !== undefined).length;
|
|
1081
1450
|
if (given !== 1)
|
|
1082
1451
|
throw new CommandError(EXIT.USAGE, "give exactly one of --head, --pr, --squash-of");
|
|
@@ -1171,7 +1540,7 @@ function runGate(ctx) {
|
|
|
1171
1540
|
// A title carrying a skip token would squash into a dev commit CI never runs on.
|
|
1172
1541
|
const title = pr?.kind === "ok" ? (pr.pr?.title ?? "") : "";
|
|
1173
1542
|
const titleToken = f.pr !== undefined ? SKIP_CI_TOKEN.exec(title)?.[0] : undefined;
|
|
1174
|
-
|
|
1543
|
+
let r = titleToken !== undefined
|
|
1175
1544
|
? {
|
|
1176
1545
|
code: GATE.TITLE_SKIP,
|
|
1177
1546
|
passed: false,
|
|
@@ -1187,6 +1556,8 @@ function runGate(ctx) {
|
|
|
1187
1556
|
repo: str(f.repo) ?? null,
|
|
1188
1557
|
skippedLanes: [],
|
|
1189
1558
|
nonBookkeepingPaths: [],
|
|
1559
|
+
failedSteps: [],
|
|
1560
|
+
regenerable: false,
|
|
1190
1561
|
reason: `PR title '${title}' contains the CI-suppressing token ${titleToken}`,
|
|
1191
1562
|
}
|
|
1192
1563
|
: shipGate({
|
|
@@ -1204,6 +1575,53 @@ function runGate(ctx) {
|
|
|
1204
1575
|
}, gh, ctx.log);
|
|
1205
1576
|
if (titleToken !== undefined)
|
|
1206
1577
|
ctx.log(r.reason);
|
|
1578
|
+
// Debug retains the configured gate above and also proves the original
|
|
1579
|
+
// selected workflow at the pushed head. A different workflow need not contain
|
|
1580
|
+
// the configured capstone, but its whole run must have completed successfully.
|
|
1581
|
+
let verifyingRun;
|
|
1582
|
+
if (r.code === EXIT.OK && selection?.mode === "ci") {
|
|
1583
|
+
const repo = str(f.repo) ?? r.repo;
|
|
1584
|
+
let reason = "";
|
|
1585
|
+
let code = GATE.FAILED;
|
|
1586
|
+
if (repo !== selection.repo) {
|
|
1587
|
+
reason = "selected CI repository differs from the gated repository";
|
|
1588
|
+
}
|
|
1589
|
+
else {
|
|
1590
|
+
const response = gh([
|
|
1591
|
+
"api",
|
|
1592
|
+
`/repos/${selection.repo}/actions/workflows/${selection.workflowId}/runs?head_sha=${queryValue(head)}`,
|
|
1593
|
+
]);
|
|
1594
|
+
if (!response.ok) {
|
|
1595
|
+
code = response.missing ? EXIT.USE_MCP : GATE.API_ERROR;
|
|
1596
|
+
reason = "selected workflow verification is unavailable";
|
|
1597
|
+
}
|
|
1598
|
+
else {
|
|
1599
|
+
const payload = jsonOrUndefined(response.stdout);
|
|
1600
|
+
const candidates = arr(obj(payload).workflow_runs)
|
|
1601
|
+
.filter((value) => String(obj(value).workflow_id) === selection.workflowId &&
|
|
1602
|
+
text(obj(obj(value).repository).full_name).toLowerCase() ===
|
|
1603
|
+
selection.repo.toLowerCase() &&
|
|
1604
|
+
text(obj(obj(value).head_repository).full_name).toLowerCase() ===
|
|
1605
|
+
selection.repo.toLowerCase() &&
|
|
1606
|
+
obj(value).head_branch === (str(f.branch) ?? selection.headBranch) &&
|
|
1607
|
+
(str(f.event) === undefined || obj(value).event === str(f.event)))
|
|
1608
|
+
.map(toRun)
|
|
1609
|
+
.filter((run) => run.head_sha === head && run.id !== null);
|
|
1610
|
+
verifyingRun = latest(candidates.filter((run) => run.status === "completed"));
|
|
1611
|
+
if (!verifyingRun) {
|
|
1612
|
+
code = candidates.length > 0 ? GATE.IN_PROGRESS : GATE.NO_RUN;
|
|
1613
|
+
reason = `selected workflow ${selection.workflowId} has no completed run at pushed head ${head}`;
|
|
1614
|
+
}
|
|
1615
|
+
else if (verifyingRun.conclusion !== "success") {
|
|
1616
|
+
reason = `selected workflow verification concluded '${verifyingRun.conclusion}' at pushed head ${head}`;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (reason) {
|
|
1621
|
+
ctx.log(reason);
|
|
1622
|
+
r = { ...r, code, passed: false, overridden: false, reason };
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1207
1625
|
if (recordFile !== undefined && r.code !== EXIT.USE_MCP) {
|
|
1208
1626
|
if (f.capstoneOnly === true) {
|
|
1209
1627
|
const verdict = r.code === EXIT.OK ? "PASS" : "FAIL";
|
|
@@ -1218,7 +1636,17 @@ function runGate(ctx) {
|
|
|
1218
1636
|
auditRow(recordFile, "ship-gate-refusal", { exitCode: r.code, head: r.mergeHead });
|
|
1219
1637
|
}
|
|
1220
1638
|
}
|
|
1221
|
-
ctx.emit({
|
|
1639
|
+
ctx.emit({
|
|
1640
|
+
...r,
|
|
1641
|
+
...(selection?.mode === "ci"
|
|
1642
|
+
? {
|
|
1643
|
+
originalRunId: selection.runId,
|
|
1644
|
+
originalRunUrl: selection.runUrl,
|
|
1645
|
+
verifyingRunId: verifyingRun?.id ?? null,
|
|
1646
|
+
verifyingRunUrl: verifyingRun?.html_url ?? null,
|
|
1647
|
+
}
|
|
1648
|
+
: {}),
|
|
1649
|
+
});
|
|
1222
1650
|
return r.code;
|
|
1223
1651
|
}
|
|
1224
1652
|
// ---------------------------------------------------------------------------
|
|
@@ -1519,8 +1947,61 @@ export const runsCommand = {
|
|
|
1519
1947
|
noun: "runs",
|
|
1520
1948
|
summary: "CI runs: wait for one, prove one was dispatched, re-validate and gate a merge on one; auto's start context.",
|
|
1521
1949
|
verbs: {
|
|
1950
|
+
locate: {
|
|
1951
|
+
summary: "Select and validate the red CI run for the adopted debug branch before local discovery: exit 0 selects red CI, 1 selects local discovery, 2 rejects arguments, 8 rejects ambiguous references, 80 requests read fallback, and 82 requires owner action for unavailable or mismatched evidence.",
|
|
1952
|
+
use: "workflow",
|
|
1953
|
+
flags: [
|
|
1954
|
+
{
|
|
1955
|
+
name: "prompt-file",
|
|
1956
|
+
type: "string",
|
|
1957
|
+
required: true,
|
|
1958
|
+
help: "session prompt; [local] overrides all CI references",
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
name: "issue-text-file",
|
|
1962
|
+
type: "string",
|
|
1963
|
+
help: "current issue description and human comments from issues text",
|
|
1964
|
+
},
|
|
1965
|
+
{ name: "branch", type: "string", required: true, help: "adopted existing branch" },
|
|
1966
|
+
{ name: "repo", type: "string", required: true, help: "owner/repository" },
|
|
1967
|
+
{
|
|
1968
|
+
name: "file",
|
|
1969
|
+
type: "string",
|
|
1970
|
+
help: "active debug status log; saved selection takes precedence over issue discovery",
|
|
1971
|
+
},
|
|
1972
|
+
{
|
|
1973
|
+
name: "selection-out",
|
|
1974
|
+
type: "string",
|
|
1975
|
+
required: true,
|
|
1976
|
+
help: "write the validated candidate selection; does not update active metadata",
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
name: "evidence-file",
|
|
1980
|
+
type: "string",
|
|
1981
|
+
help: "normalized fallback JSON: exact request identity, run, complete jobs, complete:true; automatic no-red also identifies workflow and inspected head",
|
|
1982
|
+
},
|
|
1983
|
+
],
|
|
1984
|
+
output: {
|
|
1985
|
+
selection: "ci | local",
|
|
1986
|
+
runId: "selected run ID, or null",
|
|
1987
|
+
runUrl: "selected attempt URL, or null",
|
|
1988
|
+
runAttempt: "frozen attempt, or null",
|
|
1989
|
+
workflowId: "selected workflow ID, or null",
|
|
1990
|
+
workflowPath: "selected workflow path, or null",
|
|
1991
|
+
headSha: "selected commit, or null",
|
|
1992
|
+
headRelation: "current | ancestor | null; divergent or unknown evidence exits 82",
|
|
1993
|
+
failedJobs: "complete failed-job list",
|
|
1994
|
+
tiers: "known failed tiers; empty when any failed job is unknown",
|
|
1995
|
+
via: "prompt-run | prompt-pr | issue-run | issue-pr | branch, or null",
|
|
1996
|
+
reason: "local selection reason, or null",
|
|
1997
|
+
selectionFile: "validated candidate JSON path",
|
|
1998
|
+
},
|
|
1999
|
+
exitCodes: { 8: "ambiguous winning references" },
|
|
2000
|
+
run: locateCi,
|
|
2001
|
+
},
|
|
1522
2002
|
wait: {
|
|
1523
2003
|
summary: "Bounded poll for a CI check on a PR (--pr) or a CI run at a head (--head --branch), present or completed.",
|
|
2004
|
+
use: "by-hand",
|
|
1524
2005
|
flags: [
|
|
1525
2006
|
{ name: "pr", type: "string", help: "PR number: read its check rollup" },
|
|
1526
2007
|
{ ...HEAD_FLAG, help: "commit SHA: read the CI workflow's runs at it (with --branch)" },
|
|
@@ -1559,6 +2040,7 @@ export const runsCommand = {
|
|
|
1559
2040
|
},
|
|
1560
2041
|
dispatch: {
|
|
1561
2042
|
summary: "CI-Dispatch Gate after the last push: poll, one clean re-trigger, the ciDispatch verdict, and the body scan. A run in place on dev has no PR: it polls the push-event run at the pushed sha, and its re-trigger commits and pushes only the run's own work.",
|
|
2043
|
+
use: "workflow",
|
|
1562
2044
|
flags: [
|
|
1563
2045
|
{
|
|
1564
2046
|
name: "pr",
|
|
@@ -1631,6 +2113,7 @@ export const runsCommand = {
|
|
|
1631
2113
|
ciWorkflow: "the CI workflow file the no-ci check looked for",
|
|
1632
2114
|
row: "--file: the step-done row written (null on a hand-off)",
|
|
1633
2115
|
transport: "--file: the close-transport row written for a passed verdict, else null",
|
|
2116
|
+
progressLine: "--file: the exact chat progress line after a numbered completion is recorded",
|
|
1634
2117
|
},
|
|
1635
2118
|
exitCodes: {
|
|
1636
2119
|
[EXIT_SKIP_TOKEN]: "the pushed head's body carries a CI-suppression token",
|
|
@@ -1641,7 +2124,13 @@ export const runsCommand = {
|
|
|
1641
2124
|
},
|
|
1642
2125
|
gate: {
|
|
1643
2126
|
summary: "Ship merge gate: the capstone job present and green at the head (exit 0), or why not.",
|
|
2127
|
+
use: "workflow",
|
|
1644
2128
|
flags: [
|
|
2129
|
+
{
|
|
2130
|
+
name: "ci-selection-file",
|
|
2131
|
+
type: "string",
|
|
2132
|
+
help: "validated original debug selection: additionally require its workflow to succeed at the exact pushed head",
|
|
2133
|
+
},
|
|
1645
2134
|
{ ...HEAD_FLAG, help: "the PR head to merge (or --pr / --squash-of)" },
|
|
1646
2135
|
{
|
|
1647
2136
|
name: "pr",
|
|
@@ -1706,6 +2195,10 @@ export const runsCommand = {
|
|
|
1706
2195
|
testedHead: "head the selected (or superseded) run tested",
|
|
1707
2196
|
runId: "selected run id",
|
|
1708
2197
|
runUrl: "selected run URL",
|
|
2198
|
+
originalRunId: "--ci-selection-file: original failing run ID",
|
|
2199
|
+
originalRunUrl: "--ci-selection-file: original failing attempt URL",
|
|
2200
|
+
verifyingRunId: "--ci-selection-file: selected workflow's verifying run ID at the pushed head",
|
|
2201
|
+
verifyingRunUrl: "--ci-selection-file: selected workflow's verifying run URL at the pushed head",
|
|
1709
2202
|
conclusion: "selected run conclusion",
|
|
1710
2203
|
capstone: "capstone job name",
|
|
1711
2204
|
ciWorkflow: "CI workflow file",
|
|
@@ -1730,6 +2223,7 @@ export const runsCommand = {
|
|
|
1730
2223
|
},
|
|
1731
2224
|
revalidate: {
|
|
1732
2225
|
summary: "Ship: pick the head CI must pass at, probe for a run there, dispatch only when none, wait for it to complete.",
|
|
2226
|
+
use: "workflow",
|
|
1733
2227
|
flags: [
|
|
1734
2228
|
{ name: "pr", type: "string", required: true, help: "the PR number" },
|
|
1735
2229
|
{ name: "entry-head", type: "string", required: true, help: "the PR head read at Step 2" },
|
|
@@ -1778,6 +2272,7 @@ export const runsCommand = {
|
|
|
1778
2272
|
},
|
|
1779
2273
|
mirror: {
|
|
1780
2274
|
summary: "Release PR: wait for the branch's push run at the head and copy its capstone verdict.",
|
|
2275
|
+
use: "workflow",
|
|
1781
2276
|
flags: [
|
|
1782
2277
|
{ ...HEAD_FLAG, required: true, help: "the PR head (same SHA the push run tests)" },
|
|
1783
2278
|
{ name: "branch", type: "string", help: "branch whose push run to mirror (default dev)" },
|
|
@@ -1812,6 +2307,7 @@ export const runsCommand = {
|
|
|
1812
2307
|
},
|
|
1813
2308
|
context: {
|
|
1814
2309
|
summary: "/bkit-auto Step 1: the phase and mode, the repo, and the issue / FID / PR / run the dispatch carries.",
|
|
2310
|
+
use: "workflow",
|
|
1815
2311
|
flags: [
|
|
1816
2312
|
{
|
|
1817
2313
|
name: "phase",
|
|
@@ -1858,6 +2354,7 @@ export const runsCommand = {
|
|
|
1858
2354
|
},
|
|
1859
2355
|
declared: {
|
|
1860
2356
|
summary: "Whether the repo declares a CI workflow: .github/workflows/<bkit.testing.ciWorkflow> exists (exit 0) or not (exit 1).",
|
|
2357
|
+
use: "by-hand",
|
|
1861
2358
|
flags: [],
|
|
1862
2359
|
output: {
|
|
1863
2360
|
declared: "the workflow file exists",
|