@cbartens/bkit 6.1.1 → 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 +42 -32
- 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 +97 -36
- package/.bkit/core/.bkit/templates.md +162 -34
- 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 +89 -37
- package/.bkit/core/engine/checks/after/index.ts +15 -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 +64 -11
- package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
- 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 +148 -14
- 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 +3 -1
- 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/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-machine-lock.sh +511 -103
- package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +228 -35
- package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +270 -2
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +92 -63
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
- package/.bkit/templates/slop-scan.config.json +2 -0
- package/CHANGELOG.md +64 -0
- package/DETAILS.md +24 -19
- package/README.md +1 -1
- package/dist/checks/after/auth.js +114 -46
- package/dist/checks/after/github.js +77 -35
- package/dist/checks/after/index.js +12 -3
- 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 +56 -12
- package/dist/commands/ci/push-gate.js +79 -44
- 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 +133 -14
- 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 +3 -1
- 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 +22 -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
|
@@ -246,10 +246,7 @@ export const runtimeCommand = {
|
|
|
246
246
|
run: (ctx) => {
|
|
247
247
|
const workflow = str(ctx.flags.workflow);
|
|
248
248
|
const events = readStatusEvents(statusFile(ctx));
|
|
249
|
-
const
|
|
250
|
-
.filter((r) => r.type === "runtime-resolved")
|
|
251
|
-
.filter((r) => workflow === undefined || r.workflow === workflow);
|
|
252
|
-
const row = rows[rows.length - 1];
|
|
249
|
+
const row = latestRuntimeRow(events, workflow);
|
|
253
250
|
if (!row) {
|
|
254
251
|
ctx.log(`no runtime-resolved row${workflow ? ` for ${workflow}` : ""} — Step 1 never recorded the runtime`);
|
|
255
252
|
return EXIT_NO_RUNTIME_ROW;
|
|
@@ -278,3 +275,10 @@ export const runtimeCommand = {
|
|
|
278
275
|
},
|
|
279
276
|
},
|
|
280
277
|
};
|
|
278
|
+
/** The latest `runtime-resolved` row, limited to `workflow` when given; undefined with none. */
|
|
279
|
+
export function latestRuntimeRow(events, workflow) {
|
|
280
|
+
const rows = events
|
|
281
|
+
.filter((r) => r.type === "runtime-resolved")
|
|
282
|
+
.filter((r) => workflow === undefined || r.workflow === workflow);
|
|
283
|
+
return rows[rows.length - 1];
|
|
284
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// bkit status route|resume|meta|path|row — read and annotate a workflow's `status.jsonl`.
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
2
3
|
import * as fs from "node:fs";
|
|
3
4
|
import * as path from "node:path";
|
|
4
5
|
import { BKIT_DEBUG_GATES } from "../../install/manifest.js";
|
|
5
6
|
import { appendFrictionRow, journalEnabled, pauseFrictionRow } from "../../ledgers/journal.js";
|
|
6
7
|
import { resolveGitSha } from "../../ledgers/telemetry.js";
|
|
7
8
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
8
|
-
import { activeDoneSteps, validateCiSelection, ciSelectionIdentity, allRunsDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun,
|
|
9
|
-
import { CommandError, EXIT, git, parseJson, resolveActiveRun, statusLocation, } from "../lib.js";
|
|
9
|
+
import { activeDoneSteps, validateCiSelection, ciSelectionIdentity, allRunsDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun, repeatStrategy, runNumber, runOrStepField, statusTimestamp, } from "../../ledgers/status.js";
|
|
10
|
+
import { CommandError, EXIT, git, parseJson, resolveActiveRun, statusLocation, worktreeFingerprint, writeInvocation, } from "../lib.js";
|
|
11
|
+
import { fixTestStep, gatedCheckStep } from "./loops.js";
|
|
12
|
+
import { gateRerun, openDecision } from "./open-decision.js";
|
|
10
13
|
import { WORKFLOW_STEPS, isResumable, resumePoint } from "./step-table.js";
|
|
11
14
|
// ---------------------------------------------------------------------------
|
|
12
15
|
// Shared with counters / steps
|
|
@@ -151,24 +154,38 @@ const ROUTE_FIELDS = [
|
|
|
151
154
|
];
|
|
152
155
|
/** Exit code: a `--require`d field is missing or holds a value outside its set. */
|
|
153
156
|
export const EXIT_ROUTE_MISSING = 4;
|
|
154
|
-
|
|
157
|
+
/** Debug's Step 3 test round, as `counters derive --position=current` and `status route --require=verdict` read it. */
|
|
158
|
+
function debugTestRound(runs, workflow) {
|
|
159
|
+
const rows = workflow === "debug" ? activeDoneSteps(runs, workflow, { step: "debug-run-tests" }) : [];
|
|
160
|
+
const last = rows.at(-1);
|
|
161
|
+
return {
|
|
162
|
+
testVerdict: VERDICTS.includes(String(last?.verdict)) ? last.verdict : null,
|
|
163
|
+
testSource: typeof last?.source === "string" ? last.source : null,
|
|
164
|
+
normalAttempt: rows.length === 0 ? null : rows.length,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function route(runs, rows, workflow, step, group) {
|
|
155
168
|
const out = {
|
|
156
169
|
verdict: null,
|
|
157
170
|
failures: null,
|
|
158
171
|
strategy: null,
|
|
159
172
|
nextStrategy: null,
|
|
173
|
+
repeatTests: [],
|
|
160
174
|
debugMode: null,
|
|
161
175
|
pushMode: null,
|
|
162
176
|
publish: null,
|
|
163
177
|
publishSource: null,
|
|
164
178
|
debugAttempt: 0,
|
|
165
179
|
parentSha: null,
|
|
180
|
+
source: null,
|
|
166
181
|
};
|
|
167
182
|
const problems = {};
|
|
168
183
|
if (step !== undefined) {
|
|
169
184
|
const last = activeDoneSteps(runs, workflow, { step, group }).at(-1);
|
|
170
185
|
if (typeof last?.parentSha === "string")
|
|
171
186
|
out.parentSha = last.parentSha;
|
|
187
|
+
if (typeof last?.source === "string")
|
|
188
|
+
out.source = last.source;
|
|
172
189
|
if (!last) {
|
|
173
190
|
problems.verdict = `no DONE ${step} row in the active ${workflow} run`;
|
|
174
191
|
problems.failures = problems.verdict;
|
|
@@ -191,7 +208,17 @@ function route(runs, workflow, step, group) {
|
|
|
191
208
|
const prior = lastDoneStepAllRuns(runs, workflow, { step, group })?.strategy;
|
|
192
209
|
if (prior === undefined || STRATEGIES.includes(prior)) {
|
|
193
210
|
out.strategy = prior ?? null;
|
|
194
|
-
|
|
211
|
+
// The next label comes from the tests failing now, not from the previous label.
|
|
212
|
+
const testStep = fixTestStep(step, group);
|
|
213
|
+
const check = gatedCheckStep(step);
|
|
214
|
+
const current = check === undefined
|
|
215
|
+
? undefined
|
|
216
|
+
: activeDoneSteps(runs, workflow, { step: check, group }).length;
|
|
217
|
+
const next = testStep === undefined
|
|
218
|
+
? { strategy: "STANDARD", repeatTests: [] }
|
|
219
|
+
: repeatStrategy(rows, workflow, testStep, current);
|
|
220
|
+
out.nextStrategy = next.strategy;
|
|
221
|
+
out.repeatTests = next.repeatTests;
|
|
195
222
|
}
|
|
196
223
|
else {
|
|
197
224
|
problems.strategy = `${step} strategy "${String(prior)}" is not STANDARD|PIVOT|FINAL`;
|
|
@@ -350,7 +377,7 @@ export const statusCommand = {
|
|
|
350
377
|
},
|
|
351
378
|
},
|
|
352
379
|
route: {
|
|
353
|
-
summary: "Routing state: last verdict / failures / strategy of a step, debug and push mode; with --prompt-file, debug's start decisions.",
|
|
380
|
+
summary: "Routing state: last verdict / failures / strategy of a step, debug and push mode; with --step, nextStrategy and repeatTests (the next fix round's label, from the tests failing again); with --prompt-file, debug's start decisions.",
|
|
354
381
|
use: "workflow",
|
|
355
382
|
flags: [
|
|
356
383
|
{ ...FILE_FLAG, required: false, help: `${FILE_FLAG.help}; or --fid and --month` },
|
|
@@ -390,7 +417,8 @@ export const statusCommand = {
|
|
|
390
417
|
ciReproduced: "whether the active generation has DONE reproduction with YES",
|
|
391
418
|
failures: "its failures (absent on PASS|CONCERNS = 0, absent on FAIL = null: count unknown), or null",
|
|
392
419
|
strategy: "the step's last strategy across ALL runs, or null",
|
|
393
|
-
nextStrategy: "next
|
|
420
|
+
nextStrategy: "the next fix round's label, from the tests failing now on the fix step's test step: STANDARD when none failed in an earlier attempt, PIVOT when one did in 1, FINAL in 2 or more (null without --step)",
|
|
421
|
+
repeatTests: "the tests failing now that also failed in an earlier attempt, across every run (empty without --step)",
|
|
394
422
|
debugMode: "NORMAL|SOAK of the active run, or null; with --prompt-file, the mode this invocation runs in (SOAK on [soak] in the prompt, an open run already in SOAK, or bkit.workflows.debug.fix.maxAttempts fix rounds already run across every debug run; else NORMAL)",
|
|
395
423
|
pushMode: "PR|LOCAL of the active run, or null",
|
|
396
424
|
debugAttempt: "debugAttempt of the active run (0 when unset); with --prompt-file, this invocation's run number (a resume keeps its number)",
|
|
@@ -399,6 +427,7 @@ export const statusCommand = {
|
|
|
399
427
|
publish: "with --workflow=build and --prompt-file: whether the build publishes (a publish=true|false token, else publish.local on LOCAL or publish.remote elsewhere; a non-LOCAL false resolves true), else null",
|
|
400
428
|
publishSource: "with publish: token | local | remote | coerced (a non-LOCAL false forced to true), else null",
|
|
401
429
|
parentSha: "HEAD when the step's last DONE row in the active run was written — a build-group-start row's is the group's start commit, the base for `context diff` — or null",
|
|
430
|
+
source: "the `source` field of the step's last DONE row in the active run (debug-run-tests: local|ci), or null",
|
|
402
431
|
},
|
|
403
432
|
exitCodes: {
|
|
404
433
|
[EXIT_NO_STATUS]: "status.jsonl missing, unreadable, or not valid NDJSON",
|
|
@@ -437,8 +466,9 @@ export const statusCommand = {
|
|
|
437
466
|
throw new CommandError(EXIT.USAGE, `--prompt-file ${abs} does not exist`);
|
|
438
467
|
promptText = fs.readFileSync(abs, "utf-8");
|
|
439
468
|
}
|
|
440
|
-
const
|
|
441
|
-
const
|
|
469
|
+
const statusRows = promptFile !== undefined && !fs.existsSync(file) ? [] : readStatusRows(file);
|
|
470
|
+
const runs = fold(statusRows);
|
|
471
|
+
const { out, problems } = route(runs, statusRows, String(ctx.flags.workflow), step, positiveInt(ctx.flags.group, "group"));
|
|
442
472
|
if (promptFile !== undefined) {
|
|
443
473
|
const root = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
|
|
444
474
|
const config = readBkitConfig(root);
|
|
@@ -447,8 +477,7 @@ export const statusCommand = {
|
|
|
447
477
|
delete problems.debugMode;
|
|
448
478
|
}
|
|
449
479
|
else {
|
|
450
|
-
|
|
451
|
-
Object.assign(out, publishRoute(rows, promptText, config.buildPublish));
|
|
480
|
+
Object.assign(out, publishRoute(statusRows, promptText, config.buildPublish));
|
|
452
481
|
delete problems.publish;
|
|
453
482
|
}
|
|
454
483
|
}
|
|
@@ -463,8 +492,202 @@ export const statusCommand = {
|
|
|
463
492
|
return failed.length === 0 && differ.length === 0 ? EXIT.OK : EXIT_ROUTE_MISSING;
|
|
464
493
|
},
|
|
465
494
|
},
|
|
495
|
+
invocation: {
|
|
496
|
+
summary: "Issue an engine-bound invocation: a run's step (and agent), or a runless audit or utility call.",
|
|
497
|
+
use: "workflow",
|
|
498
|
+
flags: [
|
|
499
|
+
{ ...WORKFLOW_FLAG, required: false, help: "workflow name, with --step and --file" },
|
|
500
|
+
{ ...STEP_FLAG, required: false, help: "registered step of the workflow" },
|
|
501
|
+
{ ...FILE_FLAG, required: false, help: "the run's status.jsonl, relative to the cwd" },
|
|
502
|
+
{ name: "group", type: "string", help: "the task group a group-scoped step runs for" },
|
|
503
|
+
{ name: "attempt", type: "string", help: "the attempt of that group or remediation round" },
|
|
504
|
+
{ name: "agent", type: "string", help: "the subagent this invocation is for" },
|
|
505
|
+
{ name: "host", type: "string", help: "the host running the agent" },
|
|
506
|
+
{
|
|
507
|
+
name: "configured-model",
|
|
508
|
+
type: "string",
|
|
509
|
+
help: "the pin the agent was launched with; kept apart from the observed model",
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: "observed-model",
|
|
513
|
+
type: "string",
|
|
514
|
+
help: "the model the host reported, or `unavailable`",
|
|
515
|
+
},
|
|
516
|
+
{ name: "standalone", type: "string", help: "audit|utility: a call with no run" },
|
|
517
|
+
{ name: "name", type: "string", help: "with --standalone: the audit or utility name" },
|
|
518
|
+
],
|
|
519
|
+
output: {
|
|
520
|
+
invocation: "the id to pass as --invocation to later commands",
|
|
521
|
+
receipt: "the outbox file holding the issued context",
|
|
522
|
+
scope: "run (bound to a status.jsonl) or outbox (runless audit or utility)",
|
|
523
|
+
workflow: "the workflow, or null",
|
|
524
|
+
step: "the registered step, or null",
|
|
525
|
+
number: "the step's registered number, or null",
|
|
526
|
+
title: "the step's registered title, or null",
|
|
527
|
+
run: "the workflow's run number, or null without a run",
|
|
528
|
+
statusPath: "absolute path to the run's status.jsonl, or null",
|
|
529
|
+
bookRoot: "root the run's books live under, or null",
|
|
530
|
+
group: "the task group, or null",
|
|
531
|
+
attempt: "the attempt, or null",
|
|
532
|
+
declaredStep: "audit|utility:<name> for a runless call, or null",
|
|
533
|
+
allowedAgent: "the one agent a runless call may write as, or null",
|
|
534
|
+
agent: "the agent, or null",
|
|
535
|
+
host: "the host, or null",
|
|
536
|
+
configuredModel: "the launch pin, or null",
|
|
537
|
+
observedModel: "the reported model or `unavailable`, or null",
|
|
538
|
+
},
|
|
539
|
+
exitCodes: { [EXIT_NO_STATUS]: "status.jsonl missing, unreadable, or not valid NDJSON" },
|
|
540
|
+
run: (ctx) => {
|
|
541
|
+
const top = git(ctx.cwd, ["rev-parse", "--show-toplevel"]);
|
|
542
|
+
if (top === null)
|
|
543
|
+
throw new CommandError(EXIT.USAGE, "not inside a git repository");
|
|
544
|
+
const standalone = str(ctx.flags.standalone);
|
|
545
|
+
const workflow = str(ctx.flags.workflow);
|
|
546
|
+
const step = str(ctx.flags.step);
|
|
547
|
+
const file = str(ctx.flags.file);
|
|
548
|
+
const agent = str(ctx.flags.agent) ?? null;
|
|
549
|
+
if (agent !== null && !/^[a-z0-9][a-z0-9._-]*$/.test(agent))
|
|
550
|
+
throw new CommandError(EXIT.USAGE, `--agent "${agent}" is not an agent name`);
|
|
551
|
+
const group = str(ctx.flags.group);
|
|
552
|
+
const attempt = str(ctx.flags.attempt);
|
|
553
|
+
for (const [flag, v] of [
|
|
554
|
+
["group", group],
|
|
555
|
+
["attempt", attempt],
|
|
556
|
+
])
|
|
557
|
+
if (v !== undefined && !/^[A-Za-z0-9._-]+$/.test(v))
|
|
558
|
+
throw new CommandError(EXIT.USAGE, `--${flag} "${v}" is not a ${flag} id`);
|
|
559
|
+
const base = {
|
|
560
|
+
group: group ?? null,
|
|
561
|
+
attempt: attempt ?? null,
|
|
562
|
+
agent,
|
|
563
|
+
host: str(ctx.flags.host) ?? null,
|
|
564
|
+
configuredModel: str(ctx.flags.configuredModel) ?? null,
|
|
565
|
+
// An agent whose host reported no model is recorded `unavailable`, so its rows stay writable.
|
|
566
|
+
observedModel: str(ctx.flags.observedModel) ?? (agent !== null ? "unavailable" : null),
|
|
567
|
+
};
|
|
568
|
+
let inv;
|
|
569
|
+
if (standalone !== undefined) {
|
|
570
|
+
oneOf(standalone, ["audit", "utility"], "--standalone");
|
|
571
|
+
if ([workflow, step, file].some((v) => v !== undefined))
|
|
572
|
+
throw new CommandError(EXIT.USAGE, "--standalone has no run: drop --workflow, --step and --file");
|
|
573
|
+
const name = str(ctx.flags.name);
|
|
574
|
+
if (name === undefined || name === "")
|
|
575
|
+
throw new CommandError(EXIT.USAGE, "--standalone needs --name");
|
|
576
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(name))
|
|
577
|
+
throw new CommandError(EXIT.USAGE, `--name "${name}" is not an audit or utility name`);
|
|
578
|
+
if (group !== undefined || attempt !== undefined)
|
|
579
|
+
throw new CommandError(EXIT.USAGE, "--standalone has no group or attempt");
|
|
580
|
+
inv = {
|
|
581
|
+
scope: "outbox",
|
|
582
|
+
workflow: null,
|
|
583
|
+
step: null,
|
|
584
|
+
number: null,
|
|
585
|
+
title: null,
|
|
586
|
+
run: null,
|
|
587
|
+
statusPath: null,
|
|
588
|
+
bookRoot: null,
|
|
589
|
+
standalone,
|
|
590
|
+
name,
|
|
591
|
+
declaredStep: `${standalone}:${name}`,
|
|
592
|
+
allowedAgent: agent,
|
|
593
|
+
...base,
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
if (workflow === undefined || step === undefined || file === undefined)
|
|
598
|
+
throw new CommandError(EXIT.USAGE, "give --workflow, --step and --file, or --standalone=audit|utility with --name");
|
|
599
|
+
if (ctx.flags.name !== undefined)
|
|
600
|
+
throw new CommandError(EXIT.USAGE, "--name is for --standalone");
|
|
601
|
+
if (!isResumable(workflow))
|
|
602
|
+
throw new CommandError(EXIT.USAGE, `--workflow must be ${Object.keys(WORKFLOW_STEPS).join("|")}, got "${workflow}"`);
|
|
603
|
+
const registered = WORKFLOW_STEPS[workflow].find((s) => s.step === step);
|
|
604
|
+
if (registered === undefined)
|
|
605
|
+
throw new CommandError(EXIT.USAGE, `--step ${step} is not a registered ${workflow} step`);
|
|
606
|
+
const statusPath = path.resolve(ctx.cwd, file);
|
|
607
|
+
const realFile = (() => {
|
|
608
|
+
let dir = path.dirname(statusPath);
|
|
609
|
+
const tail = [path.basename(statusPath)];
|
|
610
|
+
while (!fs.existsSync(dir) && path.dirname(dir) !== dir) {
|
|
611
|
+
tail.unshift(path.basename(dir));
|
|
612
|
+
dir = path.dirname(dir);
|
|
613
|
+
}
|
|
614
|
+
return path.join(fs.realpathSync(dir), ...tail);
|
|
615
|
+
})();
|
|
616
|
+
const realTop = fs.realpathSync(top);
|
|
617
|
+
// A status file that is itself a symlink resolves wherever it points; the parent
|
|
618
|
+
// directory alone says nothing about where appends land.
|
|
619
|
+
if (fs.lstatSync(statusPath, { throwIfNoEntry: false })?.isSymbolicLink() === true)
|
|
620
|
+
throw new CommandError(EXIT.USAGE, `--file ${file} is a symbolic link; issue the invocation for the status file itself`);
|
|
621
|
+
// The checkout that owns the file: a worktree nested under this one has its own top
|
|
622
|
+
// folder, so a plain path-prefix test would accept it.
|
|
623
|
+
let ownerDir = path.dirname(realFile);
|
|
624
|
+
while (!fs.existsSync(ownerDir) && path.dirname(ownerDir) !== ownerDir)
|
|
625
|
+
ownerDir = path.dirname(ownerDir);
|
|
626
|
+
const fileTop = git(ownerDir, ["rev-parse", "--show-toplevel"]);
|
|
627
|
+
const ownerTop = fileTop === null ? null : fs.realpathSync(fileTop);
|
|
628
|
+
if ((realFile !== realTop && !realFile.startsWith(realTop + path.sep)) ||
|
|
629
|
+
(ownerTop !== null && ownerTop !== realTop))
|
|
630
|
+
throw new CommandError(EXIT.USAGE, `--file ${file} is outside this checkout (${top}); issue the invocation from the checkout that owns the run`);
|
|
631
|
+
const logs = path.dirname(path.dirname(statusPath));
|
|
632
|
+
if (path.basename(statusPath) !== "status.jsonl" ||
|
|
633
|
+
path.basename(logs) !== "logs" ||
|
|
634
|
+
path.basename(path.dirname(path.dirname(logs))) !== "plans")
|
|
635
|
+
throw new CommandError(EXIT.USAGE, `--file ${file} is not a docs/plans/<month>/logs/<fid>/status.jsonl`);
|
|
636
|
+
inv = {
|
|
637
|
+
scope: "run",
|
|
638
|
+
workflow,
|
|
639
|
+
step,
|
|
640
|
+
number: registered.number,
|
|
641
|
+
title: registered.title,
|
|
642
|
+
run: runNumber(readRuns(statusPath), workflow),
|
|
643
|
+
statusPath,
|
|
644
|
+
bookRoot: path.dirname(path.dirname(path.dirname(path.dirname(logs)))),
|
|
645
|
+
standalone: null,
|
|
646
|
+
name: null,
|
|
647
|
+
declaredStep: null,
|
|
648
|
+
allowedAgent: null,
|
|
649
|
+
...base,
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
const id = `inv-${randomBytes(16).toString("hex")}`;
|
|
653
|
+
const issued = {
|
|
654
|
+
id,
|
|
655
|
+
version: 1,
|
|
656
|
+
...inv,
|
|
657
|
+
worktree: top,
|
|
658
|
+
issuedAt: statusTimestamp(),
|
|
659
|
+
};
|
|
660
|
+
if (issued.scope === "run" && fs.existsSync(issued.statusPath)) {
|
|
661
|
+
// The run's status log is the authority; the receipt is an index rebuilt from it.
|
|
662
|
+
const event = {
|
|
663
|
+
type: "invocation",
|
|
664
|
+
workflow: issued.workflow,
|
|
665
|
+
at: issued.issuedAt,
|
|
666
|
+
id,
|
|
667
|
+
step: issued.step,
|
|
668
|
+
number: issued.number,
|
|
669
|
+
title: issued.title,
|
|
670
|
+
run: issued.run,
|
|
671
|
+
statusPath: path.relative(top, issued.statusPath),
|
|
672
|
+
bookRoot: path.relative(top, issued.bookRoot) || ".",
|
|
673
|
+
group: issued.group,
|
|
674
|
+
attempt: issued.attempt,
|
|
675
|
+
agent: issued.agent,
|
|
676
|
+
host: issued.host,
|
|
677
|
+
configuredModel: issued.configuredModel,
|
|
678
|
+
observedModel: issued.observedModel,
|
|
679
|
+
worktree: worktreeFingerprint(top),
|
|
680
|
+
};
|
|
681
|
+
fs.appendFileSync(issued.statusPath, appendLine(event));
|
|
682
|
+
}
|
|
683
|
+
const receipt = writeInvocation(ctx.cwd, issued);
|
|
684
|
+
const { id: _id, version: _v, worktree: _w, issuedAt: _at, standalone: _s, name: _n, ...out } = issued;
|
|
685
|
+
ctx.emit({ invocation: id, receipt, ...out });
|
|
686
|
+
return EXIT.OK;
|
|
687
|
+
},
|
|
688
|
+
},
|
|
466
689
|
resume: {
|
|
467
|
-
summary: "The step a stopped run continues at: after its last DONE step, setup steps and retired rows aside.",
|
|
690
|
+
summary: "The step a stopped run continues at: after its last DONE step, setup steps and retired rows aside; gateRerun and rerunFrom say whether an open red-gate pause re-runs its gate first, and which.",
|
|
468
691
|
use: "by-hand",
|
|
469
692
|
flags: [
|
|
470
693
|
{ ...FILE_FLAG, help: "path to status.jsonl; a missing file is a run with no rows" },
|
|
@@ -479,8 +702,16 @@ export const statusCommand = {
|
|
|
479
702
|
active: "whether the latest run is this workflow, still IN_PROGRESS",
|
|
480
703
|
challengeRound: "build: the round Step 11's challenge runs as (1 up to bkit.workflows.build.challenge.maxAttempts), from the build-challenge rows' round field; null for other workflows",
|
|
481
704
|
challengeDone: "build: true once the last allowed challenge round has merged, so Step 11 goes on to Step 12; null for other workflows",
|
|
705
|
+
gateRerun: "true when the active run's open decision file (as `workflows start` prints it in openDecision) has a Gate: FAIL header, Status: OPEN, From verify, holistic or tests, and the loop question as its only undecided question: re-run that gate instead of asking again; else false",
|
|
706
|
+
rerunFrom: "verify | holistic | tests: the open decision file's From header, the check whose gate re-runs; null when gateRerun is false",
|
|
707
|
+
testVerdict: "debug: the verdict of the active run's last DONE debug-run-tests row (PASS|CONCERNS|FAIL), or null; other workflows null",
|
|
708
|
+
testSource: "debug: that row's source (local|ci), or null; other workflows null",
|
|
709
|
+
normalAttempt: "debug: the active run's DONE debug-run-tests rows (the round Steps 4-11 name their artifacts by), or null when there is none; other workflows null",
|
|
710
|
+
},
|
|
711
|
+
exitCodes: {
|
|
712
|
+
[EXIT_NO_STATUS]: "status.jsonl unreadable or not valid NDJSON",
|
|
713
|
+
[EXIT_ROUTE_MISSING]: "debug: the run continues after Step 3 and Step 3's test round has no DONE row or no PASS|CONCERNS|FAIL verdict",
|
|
482
714
|
},
|
|
483
|
-
exitCodes: { [EXIT_NO_STATUS]: "status.jsonl unreadable or not valid NDJSON" },
|
|
484
715
|
run: (ctx) => {
|
|
485
716
|
const workflow = String(ctx.flags.workflow);
|
|
486
717
|
if (!isResumable(workflow))
|
|
@@ -488,9 +719,24 @@ export const statusCommand = {
|
|
|
488
719
|
const file = statusFile(ctx);
|
|
489
720
|
const root = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
|
|
490
721
|
const challengeMax = readBkitConfig(root).asks["build.challenge"].max;
|
|
722
|
+
const runs = fs.existsSync(file) ? readRuns(file) : [];
|
|
723
|
+
const point = resumePoint(runs, workflow, challengeMax);
|
|
724
|
+
const current = point.active ? lastRun(runs, workflow) : undefined;
|
|
725
|
+
const open = current === undefined
|
|
726
|
+
? null
|
|
727
|
+
: openDecision(path.dirname(file), root, workflow, runNumber(runs, workflow), current.steps
|
|
728
|
+
.filter((s) => s.step === `${workflow}-decision`)
|
|
729
|
+
.flatMap((s) => s.artifacts));
|
|
730
|
+
const round = debugTestRound(runs, workflow);
|
|
491
731
|
ctx.emit({
|
|
492
|
-
...
|
|
732
|
+
...point,
|
|
733
|
+
...gateRerun(open, open === null ? "" : fs.readFileSync(path.resolve(root, open.file), "utf-8")),
|
|
734
|
+
...round,
|
|
493
735
|
});
|
|
736
|
+
if (workflow === "debug" && point.number > 3 && round.testVerdict === null) {
|
|
737
|
+
ctx.log("debug resumes after Step 3, but no DONE debug-run-tests row with a verdict is in the active run");
|
|
738
|
+
return EXIT_ROUTE_MISSING;
|
|
739
|
+
}
|
|
494
740
|
return EXIT.OK;
|
|
495
741
|
},
|
|
496
742
|
},
|
|
@@ -72,7 +72,29 @@ export const WORKFLOW_STEPS = {
|
|
|
72
72
|
title: "Plan Gaps Remediate",
|
|
73
73
|
resumeAt: "build-plan-verify",
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
// Holistic verify never passes on alone: its gate runs after every verdict, so a run
|
|
76
|
+
// stopped between the two runs the round again. Step 10 again.
|
|
77
|
+
{
|
|
78
|
+
step: "build-plan-verify-holistic",
|
|
79
|
+
number: 10,
|
|
80
|
+
title: "Plan Verify Holistic",
|
|
81
|
+
resumeAt: "build-plan-verify-holistic",
|
|
82
|
+
},
|
|
83
|
+
// The holistic gate routes with its verify: Step 10 again.
|
|
84
|
+
{
|
|
85
|
+
step: "build-holistic-gate",
|
|
86
|
+
number: 10,
|
|
87
|
+
title: "Plan Verify Holistic",
|
|
88
|
+
resumeAt: "build-plan-verify-holistic",
|
|
89
|
+
},
|
|
90
|
+
// A holistic fix can add a takeover group: Step 7 runs it, and goes straight on to
|
|
91
|
+
// Step 10 when no group is open.
|
|
92
|
+
{
|
|
93
|
+
step: "build-plan-gaps-remediate-holistic",
|
|
94
|
+
number: 10,
|
|
95
|
+
title: "Plan Verify Holistic",
|
|
96
|
+
resumeAt: "build-plan-tasks",
|
|
97
|
+
},
|
|
76
98
|
// The reports are written: Step 11 continues at `bkit challenge merge`.
|
|
77
99
|
{ step: "build-challenge", number: 11, title: "Build Challenge", resumeAt: "build-challenge" },
|
|
78
100
|
// Run Tests routes on its own verdict, and a fix loops back to it.
|
|
@@ -141,25 +163,15 @@ export const WORKFLOW_STEPS = {
|
|
|
141
163
|
{ step: "ship-prune-skills", number: 7, title: "Prune Skills" },
|
|
142
164
|
{ step: "ship-bookkeeping-push", number: 8, title: "Commit + Push Bookkeeping" },
|
|
143
165
|
{ number: 9, title: "Re-validate" },
|
|
144
|
-
// The merge gate reads the PR state again: a merged PR goes on to Step
|
|
166
|
+
// The merge gate reads the PR state again: a merged PR goes on to Step 11.
|
|
145
167
|
{
|
|
146
168
|
step: "ship-merge-pr",
|
|
147
169
|
number: 10,
|
|
148
170
|
title: "Merge Gate + Merge PR",
|
|
149
171
|
resumeAt: "ship-merge-pr",
|
|
150
172
|
},
|
|
151
|
-
{ step: "ship-
|
|
152
|
-
|
|
153
|
-
// new), then re-validated at Step 9; any other verdict re-reads the PR at Step 10.
|
|
154
|
-
{
|
|
155
|
-
step: "ship-failure-remediate",
|
|
156
|
-
number: 12,
|
|
157
|
-
title: "Failure Remediate",
|
|
158
|
-
resumeAt: "ship-merge-pr",
|
|
159
|
-
resumeOnVerdict: { PASS: "ship-failure-remediate" },
|
|
160
|
-
},
|
|
161
|
-
{ step: "ship-switch-to-dev", number: 13, title: "Update Local Dev" },
|
|
162
|
-
{ step: "ship-close-workflow", number: 14, title: "Close Workflow" },
|
|
173
|
+
{ step: "ship-switch-to-dev", number: 11, title: "Update Local Dev" },
|
|
174
|
+
{ step: "ship-close-workflow", number: 12, title: "Close Workflow" },
|
|
163
175
|
],
|
|
164
176
|
};
|
|
165
177
|
/**
|
|
@@ -186,13 +198,27 @@ export const DECISION_ROUTES = {
|
|
|
186
198
|
routes: {
|
|
187
199
|
fix: "build-plan-tasks",
|
|
188
200
|
verify: "build-plan-verify",
|
|
201
|
+
holistic: "build-plan-verify-holistic",
|
|
189
202
|
tests: "build-run-tests",
|
|
190
|
-
// Try again: a verify loop goes on to its gaps fix (Step 9), a tests loop to Step 13.
|
|
203
|
+
// Try again: a verify loop goes on to its gaps fix (Step 9 or Step 10's), a tests loop to Step 13.
|
|
191
204
|
retry: {
|
|
192
205
|
"build-plan-verify": "build-plan-gaps-remediate",
|
|
193
206
|
"build-group-gate": "build-plan-gaps-remediate",
|
|
207
|
+
"build-plan-verify-holistic": "build-plan-gaps-remediate-holistic",
|
|
208
|
+
"build-holistic-gate": "build-plan-gaps-remediate-holistic",
|
|
209
|
+
"build-plan-gaps-remediate-holistic": "build-plan-gaps-remediate-holistic",
|
|
194
210
|
"build-run-tests": "build-failure-diagnose",
|
|
195
211
|
},
|
|
212
|
+
// Continue: every gap accepted, so the loop is settled. A group verify goes on to the next
|
|
213
|
+
// group's Plan Execute, a holistic round to Build Challenge.
|
|
214
|
+
continue: {
|
|
215
|
+
"build-plan-verify": "build-plan-tasks",
|
|
216
|
+
"build-group-gate": "build-plan-tasks",
|
|
217
|
+
"build-plan-gaps-remediate": "build-plan-tasks",
|
|
218
|
+
"build-plan-verify-holistic": "build-challenge",
|
|
219
|
+
"build-holistic-gate": "build-challenge",
|
|
220
|
+
"build-plan-gaps-remediate-holistic": "build-challenge",
|
|
221
|
+
},
|
|
196
222
|
},
|
|
197
223
|
},
|
|
198
224
|
};
|