@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
|
@@ -170,6 +170,7 @@ export const runtimeCommand = {
|
|
|
170
170
|
verbs: {
|
|
171
171
|
detect: {
|
|
172
172
|
summary: "Classify the runtime, its default capabilities, gh auth, and the worktree path.",
|
|
173
|
+
use: "by-hand",
|
|
173
174
|
flags: [FID_FLAG],
|
|
174
175
|
output: {
|
|
175
176
|
...TABLE_OUTPUT,
|
|
@@ -187,6 +188,7 @@ export const runtimeCommand = {
|
|
|
187
188
|
},
|
|
188
189
|
row: {
|
|
189
190
|
summary: "Detect, then build the runtime-resolved row (and append it with --file).",
|
|
191
|
+
use: "workflow",
|
|
190
192
|
flags: [
|
|
191
193
|
WORKFLOW_FLAG,
|
|
192
194
|
{
|
|
@@ -225,6 +227,7 @@ export const runtimeCommand = {
|
|
|
225
227
|
},
|
|
226
228
|
assert: {
|
|
227
229
|
summary: "Read back the latest runtime-resolved row and fail unless every field is resolved.",
|
|
230
|
+
use: "workflow",
|
|
228
231
|
flags: [
|
|
229
232
|
FILE_FLAG,
|
|
230
233
|
{ ...WORKFLOW_FLAG, required: false, help: "only rows written by this workflow" },
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { BKIT_DEBUG_GATES } from "../../install/manifest.js";
|
|
5
|
+
import { appendFrictionRow, journalEnabled, pauseFrictionRow } from "../../ledgers/journal.js";
|
|
6
|
+
import { resolveGitSha } from "../../ledgers/telemetry.js";
|
|
5
7
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
6
|
-
import { activeDoneSteps, allRunsDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun, nextStrategy, runNumber, runOrStepField, statusTimestamp, } from "../../ledgers/status.js";
|
|
7
|
-
import { CommandError, EXIT, git, parseJson, statusLocation, } from "../lib.js";
|
|
8
|
+
import { activeDoneSteps, validateCiSelection, ciSelectionIdentity, allRunsDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun, nextStrategy, runNumber, runOrStepField, statusTimestamp, } from "../../ledgers/status.js";
|
|
9
|
+
import { CommandError, EXIT, git, parseJson, resolveActiveRun, statusLocation, } from "../lib.js";
|
|
8
10
|
import { WORKFLOW_STEPS, isResumable, resumePoint } from "./step-table.js";
|
|
9
11
|
// ---------------------------------------------------------------------------
|
|
10
12
|
// Shared with counters / steps
|
|
@@ -30,10 +32,12 @@ export const STEP_FLAG = {
|
|
|
30
32
|
export const GROUP_FLAG = {
|
|
31
33
|
name: "group",
|
|
32
34
|
type: "string",
|
|
33
|
-
help: "only rows for this
|
|
35
|
+
help: "only rows for this task group (positive integer)",
|
|
34
36
|
};
|
|
35
37
|
/** Exit code: status.jsonl missing, unreadable, or not valid NDJSON. */
|
|
36
38
|
export const EXIT_NO_STATUS = 3;
|
|
39
|
+
/** Exit code: the owner-pause friction row was not written; the status row is kept. */
|
|
40
|
+
export const EXIT_PAUSE_FRICTION = 4;
|
|
37
41
|
/** Every row of status.jsonl, whatever its type; exit 3 when the file is missing or a line is not JSON. */
|
|
38
42
|
export function readStatusRows(file) {
|
|
39
43
|
if (!fs.existsSync(file))
|
|
@@ -62,6 +66,14 @@ export function readStatusRowsAt(file, ref) {
|
|
|
62
66
|
throw new CommandError(EXIT_NO_STATUS, `${spec} does not exist`);
|
|
63
67
|
return parseStatusRows(text, spec);
|
|
64
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Step names a row may carry from before a rename, read as the current name so a run
|
|
71
|
+
* in flight across the rename folds, resumes and counts as one (`docs/migrations.md`).
|
|
72
|
+
* The row on disk is history and is not rewritten.
|
|
73
|
+
*/
|
|
74
|
+
const RENAMED_STEPS = {
|
|
75
|
+
"build-plan-execute": "build-plan-tasks",
|
|
76
|
+
};
|
|
65
77
|
/** Parse NDJSON status text; `label` names it in errors. Malformed is an error, never "no rows". */
|
|
66
78
|
function parseStatusRows(text, label) {
|
|
67
79
|
return text
|
|
@@ -75,7 +87,9 @@ function parseStatusRows(text, label) {
|
|
|
75
87
|
if (typeof parsed.value !== "object" || parsed.value === null) {
|
|
76
88
|
throw new CommandError(EXIT_NO_STATUS, `${label} line ${i + 1} is not a JSON object`);
|
|
77
89
|
}
|
|
78
|
-
|
|
90
|
+
const row = parsed.value;
|
|
91
|
+
const renamed = typeof row.step === "string" ? RENAMED_STEPS[row.step] : undefined;
|
|
92
|
+
return renamed === undefined ? row : { ...row, step: renamed };
|
|
79
93
|
});
|
|
80
94
|
}
|
|
81
95
|
/** The rows as the fold reads them; the fold skips types it does not model. */
|
|
@@ -127,7 +141,14 @@ const VERDICTS = ["PASS", "CONCERNS", "FAIL"];
|
|
|
127
141
|
const DEBUG_MODES = ["NORMAL", "SOAK"];
|
|
128
142
|
const PUSH_MODES = ["PR", "LOCAL"];
|
|
129
143
|
const STRATEGIES = ["STANDARD", "PIVOT", "FINAL"];
|
|
130
|
-
const ROUTE_FIELDS = [
|
|
144
|
+
const ROUTE_FIELDS = [
|
|
145
|
+
"verdict",
|
|
146
|
+
"failures",
|
|
147
|
+
"strategy",
|
|
148
|
+
"debugMode",
|
|
149
|
+
"pushMode",
|
|
150
|
+
"publish",
|
|
151
|
+
];
|
|
131
152
|
/** Exit code: a `--require`d field is missing or holds a value outside its set. */
|
|
132
153
|
export const EXIT_ROUTE_MISSING = 4;
|
|
133
154
|
function route(runs, workflow, step, group) {
|
|
@@ -138,6 +159,8 @@ function route(runs, workflow, step, group) {
|
|
|
138
159
|
nextStrategy: null,
|
|
139
160
|
debugMode: null,
|
|
140
161
|
pushMode: null,
|
|
162
|
+
publish: null,
|
|
163
|
+
publishSource: null,
|
|
141
164
|
debugAttempt: 0,
|
|
142
165
|
parentSha: null,
|
|
143
166
|
};
|
|
@@ -185,6 +208,7 @@ function route(runs, workflow, step, group) {
|
|
|
185
208
|
problems[field] =
|
|
186
209
|
value === "" ? `${field} not recorded` : `${field} "${value}" is not ${allowed.join("|")}`;
|
|
187
210
|
}
|
|
211
|
+
problems.publish = "publish not resolved: needs --workflow=build with --prompt-file";
|
|
188
212
|
const attempt = Number(lastRun(runs, workflow)?.debugAttempt ?? 0);
|
|
189
213
|
out.debugAttempt = Number.isFinite(attempt) ? attempt : 0;
|
|
190
214
|
return { out, problems };
|
|
@@ -205,13 +229,52 @@ export function debugStart(runs, promptText, fixMax) {
|
|
|
205
229
|
open.steps.some((s) => s.step === "debug-failure-soak" && s.status === "DONE"));
|
|
206
230
|
const fixes = allRunsDoneSteps(runs, "debug", { step: "debug-failure-remediate" }).length;
|
|
207
231
|
const debugMode = promptText.includes("[soak]") || soaking || fixes >= fixMax ? "SOAK" : "NORMAL";
|
|
232
|
+
const selection = !promptText.includes("[local]") && validateCiSelection(open?.ciSelection)
|
|
233
|
+
? open.ciSelection
|
|
234
|
+
: null;
|
|
235
|
+
const ci = selection?.mode === "ci" ? selection : null;
|
|
236
|
+
const ciGeneration = typeof open?.ciGeneration === "number" ? open.ciGeneration : 0;
|
|
237
|
+
const current = open?.steps.filter((s) => s.status === "DONE" && s.ciGeneration === ciGeneration) ?? [];
|
|
238
|
+
const defaults = promptText.includes("[live=off]")
|
|
239
|
+
? BKIT_DEBUG_GATES.filter((g) => !g.endsWith("-live"))
|
|
240
|
+
: [...BKIT_DEBUG_GATES];
|
|
241
|
+
const covering = ci && ci.redTiers.length > 0
|
|
242
|
+
? defaults
|
|
243
|
+
.filter((g) => ci.redTiers.every((tier) => g.slice("bkit:gate:".length).split("-").includes(tier)))
|
|
244
|
+
.reverse()
|
|
245
|
+
: [];
|
|
208
246
|
return {
|
|
209
247
|
debugAttempt: attempt,
|
|
210
248
|
debugMode,
|
|
211
249
|
repro: promptText.includes("[repro]"),
|
|
212
|
-
gates:
|
|
213
|
-
|
|
214
|
-
|
|
250
|
+
gates: [...new Set([...covering, ...defaults])],
|
|
251
|
+
ciRun: ci?.runId ?? null,
|
|
252
|
+
ciGeneration,
|
|
253
|
+
redTiers: ci?.redTiers ?? [],
|
|
254
|
+
ciFixDone: ci !== null &&
|
|
255
|
+
current.some((s) => ["debug-failure-remediate", "debug-failure-soak"].includes(s.step)),
|
|
256
|
+
ciReproduced: ci !== null &&
|
|
257
|
+
current.some((s) => s.step === "debug-failure-reproduce" && s.reproduced === "YES"),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const PUBLISH_TOKEN = /(?<![\w-])publish=(true|false)(?![\w-])/;
|
|
261
|
+
/**
|
|
262
|
+
* Build's ending, from the session prompt, `bkit.workflows.build.publish` and the runtime.
|
|
263
|
+
* A `publish=true|false` token wins; else LOCAL reads `publish.local` and any other runtime
|
|
264
|
+
* `publish.remote`. A non-LOCAL `false` resolves `true`. No `runtime-resolved` row throws.
|
|
265
|
+
*/
|
|
266
|
+
export function publishRoute(rows, promptText, config) {
|
|
267
|
+
const row = rows.filter((r) => r.type === "runtime-resolved" && r.workflow === "build").at(-1);
|
|
268
|
+
if (row === undefined)
|
|
269
|
+
throw new CommandError(EXIT_ROUTE_MISSING, "no runtime-resolved row for build: Step 2 never recorded the runtime");
|
|
270
|
+
const local = row.runtime === "LOCAL";
|
|
271
|
+
const token = PUBLISH_TOKEN.exec(promptText)?.[1];
|
|
272
|
+
const wanted = token !== undefined ? token === "true" : local ? config.local : config.remote;
|
|
273
|
+
if (!local && !wanted)
|
|
274
|
+
return { publish: true, publishSource: "coerced" };
|
|
275
|
+
return {
|
|
276
|
+
publish: wanted,
|
|
277
|
+
publishSource: token !== undefined ? "token" : local ? "local" : "remote",
|
|
215
278
|
};
|
|
216
279
|
}
|
|
217
280
|
/** `--file`, else the debug status.jsonl `--fid` and `--month` name. */
|
|
@@ -261,6 +324,7 @@ export const statusCommand = {
|
|
|
261
324
|
verbs: {
|
|
262
325
|
path: {
|
|
263
326
|
summary: "Where this workflow's status.jsonl lives.",
|
|
327
|
+
use: "by-hand",
|
|
264
328
|
flags: [
|
|
265
329
|
WORKFLOW_FLAG,
|
|
266
330
|
{ name: "fid", type: "string", required: true, help: "feature id" },
|
|
@@ -287,6 +351,7 @@ export const statusCommand = {
|
|
|
287
351
|
},
|
|
288
352
|
route: {
|
|
289
353
|
summary: "Routing state: last verdict / failures / strategy of a step, debug and push mode; with --prompt-file, debug's start decisions.",
|
|
354
|
+
use: "workflow",
|
|
290
355
|
flags: [
|
|
291
356
|
{ ...FILE_FLAG, required: false, help: `${FILE_FLAG.help}; or --fid and --month` },
|
|
292
357
|
WORKFLOW_FLAG,
|
|
@@ -311,13 +376,18 @@ export const statusCommand = {
|
|
|
311
376
|
{
|
|
312
377
|
name: "prompt-file",
|
|
313
378
|
type: "string",
|
|
314
|
-
help: "debug
|
|
379
|
+
help: "debug or build: the session prompt; debug: this run's attempt, mode, repro and gates (a missing status.jsonl is a fresh run); build: publish and publishSource",
|
|
315
380
|
},
|
|
316
381
|
{ name: "fid", type: "string", help: "with --prompt-file, in place of --file: feature id" },
|
|
317
382
|
{ name: "month", type: "string", help: "with --prompt-file, in place of --file: YYYYMM" },
|
|
318
383
|
],
|
|
319
384
|
output: {
|
|
320
385
|
verdict: "PASS|CONCERNS|FAIL of the step's last DONE row in the active run, or null",
|
|
386
|
+
ciRun: "active saved CI run ID with --prompt-file, or null; explicit [local] clears it",
|
|
387
|
+
ciGeneration: "active saved selection generation with --prompt-file, or 0",
|
|
388
|
+
redTiers: "active selected failed tiers with --prompt-file; empty for local or unknown jobs",
|
|
389
|
+
ciFixDone: "whether the active generation has a DONE remediation or soak",
|
|
390
|
+
ciReproduced: "whether the active generation has DONE reproduction with YES",
|
|
321
391
|
failures: "its failures (absent on PASS|CONCERNS = 0, absent on FAIL = null: count unknown), or null",
|
|
322
392
|
strategy: "the step's last strategy across ALL runs, or null",
|
|
323
393
|
nextStrategy: "next rung: STANDARD, PIVOT, FINAL (null without --step)",
|
|
@@ -326,6 +396,8 @@ export const statusCommand = {
|
|
|
326
396
|
debugAttempt: "debugAttempt of the active run (0 when unset); with --prompt-file, this invocation's run number (a resume keeps its number)",
|
|
327
397
|
repro: "with --prompt-file: [repro] in the prompt",
|
|
328
398
|
gates: "with --prompt-file: the gates to try, deepest first; [live=off] in the prompt drops the live gate",
|
|
399
|
+
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
|
+
publishSource: "with publish: token | local | remote | coerced (a non-LOCAL false forced to true), else null",
|
|
329
401
|
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",
|
|
330
402
|
},
|
|
331
403
|
exitCodes: {
|
|
@@ -355,8 +427,8 @@ export const statusCommand = {
|
|
|
355
427
|
}
|
|
356
428
|
}
|
|
357
429
|
const promptFile = str(ctx.flags.promptFile);
|
|
358
|
-
if (promptFile !== undefined && ctx.flags.workflow
|
|
359
|
-
throw new CommandError(EXIT.USAGE, "--prompt-file is for --workflow=debug");
|
|
430
|
+
if (promptFile !== undefined && !["debug", "build"].includes(String(ctx.flags.workflow)))
|
|
431
|
+
throw new CommandError(EXIT.USAGE, "--prompt-file is for --workflow=debug or build");
|
|
360
432
|
const file = routeFile(ctx);
|
|
361
433
|
let promptText = "";
|
|
362
434
|
if (promptFile !== undefined) {
|
|
@@ -369,9 +441,16 @@ export const statusCommand = {
|
|
|
369
441
|
const { out, problems } = route(runs, String(ctx.flags.workflow), step, positiveInt(ctx.flags.group, "group"));
|
|
370
442
|
if (promptFile !== undefined) {
|
|
371
443
|
const root = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
444
|
+
const config = readBkitConfig(root);
|
|
445
|
+
if (ctx.flags.workflow === "debug") {
|
|
446
|
+
Object.assign(out, debugStart(runs, promptText, config.asks["debug.fix"].max));
|
|
447
|
+
delete problems.debugMode;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
const rows = fs.existsSync(file) ? readStatusRows(file) : [];
|
|
451
|
+
Object.assign(out, publishRoute(rows, promptText, config.buildPublish));
|
|
452
|
+
delete problems.publish;
|
|
453
|
+
}
|
|
375
454
|
}
|
|
376
455
|
ctx.emit(out);
|
|
377
456
|
const failed = required.filter((r) => problems[r] !== undefined);
|
|
@@ -386,6 +465,7 @@ export const statusCommand = {
|
|
|
386
465
|
},
|
|
387
466
|
resume: {
|
|
388
467
|
summary: "The step a stopped run continues at: after its last DONE step, setup steps and retired rows aside.",
|
|
468
|
+
use: "by-hand",
|
|
389
469
|
flags: [
|
|
390
470
|
{ ...FILE_FLAG, help: "path to status.jsonl; a missing file is a run with no rows" },
|
|
391
471
|
{ ...WORKFLOW_FLAG, help: `workflow name: ${Object.keys(WORKFLOW_STEPS).join(", ")}` },
|
|
@@ -395,10 +475,10 @@ export const statusCommand = {
|
|
|
395
475
|
number: "the step number to continue at (1 when no run is active)",
|
|
396
476
|
title: "the step heading's title",
|
|
397
477
|
after: "the DONE row that placed it, or null",
|
|
398
|
-
group: "that row's
|
|
478
|
+
group: "that row's task group, or null",
|
|
399
479
|
active: "whether the latest run is this workflow, still IN_PROGRESS",
|
|
400
|
-
challengeRound: "build: the round Step
|
|
401
|
-
challengeDone: "build: true once the last allowed challenge round has merged, so Step
|
|
480
|
+
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
|
+
challengeDone: "build: true once the last allowed challenge round has merged, so Step 11 goes on to Step 12; null for other workflows",
|
|
402
482
|
},
|
|
403
483
|
exitCodes: { [EXIT_NO_STATUS]: "status.jsonl unreadable or not valid NDJSON" },
|
|
404
484
|
run: (ctx) => {
|
|
@@ -416,6 +496,7 @@ export const statusCommand = {
|
|
|
416
496
|
},
|
|
417
497
|
meta: {
|
|
418
498
|
summary: "Append a workflow-meta row (run-level routing state).",
|
|
499
|
+
use: "workflow",
|
|
419
500
|
flags: [
|
|
420
501
|
FILE_FLAG,
|
|
421
502
|
WORKFLOW_FLAG,
|
|
@@ -427,6 +508,11 @@ export const statusCommand = {
|
|
|
427
508
|
help: "positive integer, or run (the active run's number)",
|
|
428
509
|
},
|
|
429
510
|
{ name: "opened-pr", type: "boolean", help: "record openedPr: this run opened the PR" },
|
|
511
|
+
{
|
|
512
|
+
name: "ci-selection-file",
|
|
513
|
+
type: "string",
|
|
514
|
+
help: "validated atomic debug CI or local selection JSON",
|
|
515
|
+
},
|
|
430
516
|
],
|
|
431
517
|
output: { row: "the appended workflow-meta row" },
|
|
432
518
|
exitCodes: { [EXIT_NO_STATUS]: "status.jsonl does not exist (meta never starts a log)" },
|
|
@@ -434,6 +520,22 @@ export const statusCommand = {
|
|
|
434
520
|
const file = statusFile(ctx);
|
|
435
521
|
const at = statusTimestamp();
|
|
436
522
|
const fields = {};
|
|
523
|
+
if (ctx.flags.ciSelectionFile !== undefined) {
|
|
524
|
+
const parsed = parseJson(fs.readFileSync(path.resolve(ctx.cwd, String(ctx.flags.ciSelectionFile)), "utf-8"));
|
|
525
|
+
const selection = parsed.ok ? parsed.value : null;
|
|
526
|
+
if (!validateCiSelection(selection))
|
|
527
|
+
throw new CommandError(EXIT.USAGE, "invalid CI selection");
|
|
528
|
+
const active = readRuns(file).at(-1);
|
|
529
|
+
if (ctx.flags.workflow !== "debug" ||
|
|
530
|
+
active?.workflow !== "debug" ||
|
|
531
|
+
active.status !== "IN_PROGRESS")
|
|
532
|
+
throw new CommandError(EXIT.USAGE, "CI selection needs an active debug run");
|
|
533
|
+
const same = validateCiSelection(active.ciSelection) &&
|
|
534
|
+
ciSelectionIdentity(active.ciSelection) === ciSelectionIdentity(selection);
|
|
535
|
+
fields.ciSelection =
|
|
536
|
+
selection.mode === "local" ? { mode: "local", reason: selection.reason } : selection;
|
|
537
|
+
fields.ciGeneration = (Number(active.ciGeneration) || 0) + (same ? 0 : 1);
|
|
538
|
+
}
|
|
437
539
|
for (const { key, check } of Object.values(META_FIELDS)) {
|
|
438
540
|
const v = str(ctx.flags[key]);
|
|
439
541
|
// `--debug-attempt=run`: the active run's number, read once the log is known to exist.
|
|
@@ -466,7 +568,8 @@ export const statusCommand = {
|
|
|
466
568
|
},
|
|
467
569
|
},
|
|
468
570
|
row: {
|
|
469
|
-
summary: "Append a typed audit row the fold does not model (ship's gate refusals, CI probes, merge CI).",
|
|
571
|
+
summary: "Append a typed audit row the fold does not model (ship's gate refusals, CI probes, merge CI); an owner-pause row also logs a human-confirm friction row.",
|
|
572
|
+
use: "workflow",
|
|
470
573
|
flags: [
|
|
471
574
|
FILE_FLAG,
|
|
472
575
|
WORKFLOW_FLAG,
|
|
@@ -484,7 +587,10 @@ export const statusCommand = {
|
|
|
484
587
|
},
|
|
485
588
|
],
|
|
486
589
|
output: { row: "the appended row" },
|
|
487
|
-
exitCodes: {
|
|
590
|
+
exitCodes: {
|
|
591
|
+
[EXIT_NO_STATUS]: "status.jsonl does not exist (a row never starts a log)",
|
|
592
|
+
[EXIT_PAUSE_FRICTION]: "an owner-pause row was appended but its human-confirm friction row was not written",
|
|
593
|
+
},
|
|
488
594
|
run: (ctx) => {
|
|
489
595
|
const type = String(ctx.flags.type);
|
|
490
596
|
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(type))
|
|
@@ -504,10 +610,51 @@ export const statusCommand = {
|
|
|
504
610
|
at: statusTimestamp(),
|
|
505
611
|
...fields,
|
|
506
612
|
};
|
|
613
|
+
const prior = type === "owner-pause" ? fs.readFileSync(file, "utf-8") : "";
|
|
507
614
|
fs.appendFileSync(file, appendLine(row));
|
|
615
|
+
if (type === "owner-pause")
|
|
616
|
+
recordPause(ctx.cwd, file, row, prior);
|
|
508
617
|
ctx.emit({ row });
|
|
509
618
|
return EXIT.OK;
|
|
510
619
|
},
|
|
511
620
|
},
|
|
512
621
|
},
|
|
513
622
|
};
|
|
623
|
+
const pauseReason = (row) => row["reason"] === undefined ? undefined : String(row["reason"]);
|
|
624
|
+
/**
|
|
625
|
+
* Log an owner pause as `human-confirm` friction in the active run's books. A
|
|
626
|
+
* follow-up wait writes nothing: `prior` (the status file before this row) holds an
|
|
627
|
+
* `owner-pause` row with the same workflow and reason and no `step-done` row after it.
|
|
628
|
+
* Nothing is written outside an active run or with `BKIT_ENGINE_JOURNAL=off`.
|
|
629
|
+
*/
|
|
630
|
+
function recordPause(cwd, file, row, prior) {
|
|
631
|
+
if (!journalEnabled())
|
|
632
|
+
return;
|
|
633
|
+
const reason = pauseReason(row);
|
|
634
|
+
let waiting = false;
|
|
635
|
+
for (const line of prior.split("\n")) {
|
|
636
|
+
const parsed = parseJson(line);
|
|
637
|
+
if (!parsed.ok || parsed.value === null || typeof parsed.value !== "object")
|
|
638
|
+
continue;
|
|
639
|
+
const r = parsed.value;
|
|
640
|
+
if (r["type"] === "step-done")
|
|
641
|
+
waiting = false;
|
|
642
|
+
else if (r["type"] === "owner-pause" && r["workflow"] === row.workflow) {
|
|
643
|
+
waiting ||= pauseReason(r) === reason;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (waiting)
|
|
647
|
+
return;
|
|
648
|
+
const run = resolveActiveRun({ cwd, file });
|
|
649
|
+
if (run === undefined)
|
|
650
|
+
return;
|
|
651
|
+
const wrote = appendFrictionRow(run.bookRoot, pauseFrictionRow({
|
|
652
|
+
workflow: row.workflow,
|
|
653
|
+
reason,
|
|
654
|
+
bookRoot: run.bookRoot,
|
|
655
|
+
parentSha: resolveGitSha("HEAD", run.bookRoot),
|
|
656
|
+
}));
|
|
657
|
+
if (!wrote.ok) {
|
|
658
|
+
throw new CommandError(EXIT_PAUSE_FRICTION, `owner-pause row kept; its friction row was not written: ${wrote.error}`);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
@@ -31,55 +31,62 @@ export const WORKFLOW_STEPS = {
|
|
|
31
31
|
{ step: "design-apply-review", number: 8, title: "Apply Review" },
|
|
32
32
|
{ step: "design-organise", number: 9, title: "Design Organise" },
|
|
33
33
|
{ step: "design-summary", number: 10, title: "Summary" },
|
|
34
|
-
{ step: "design-workstream-suggest", number: 11, title: "Suggest
|
|
34
|
+
{ step: "design-workstream-suggest", number: 11, title: "Suggest Plans" },
|
|
35
35
|
{ step: "design-close-workflow", number: 12, title: "Close Workflow" },
|
|
36
36
|
],
|
|
37
37
|
build: [
|
|
38
38
|
{ step: "build-start-workflow", number: 1, title: "Start Workflow", setup: true },
|
|
39
39
|
{ step: "build-worktree-setup", number: 2, title: "Worktree Setup", setup: true },
|
|
40
|
-
// A converted plan is checked again: Step 3 runs its plan check once more.
|
|
41
|
-
{ step: "build-plan-convert", number: 3, title: "Branch Sync", resumeAt: "build-branch-sync" },
|
|
42
40
|
{ step: "build-branch-sync", number: 3, title: "Branch Sync" },
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
|
|
41
|
+
// A converted plan is checked again: Step 4 runs its plan check once more.
|
|
42
|
+
{
|
|
43
|
+
step: "build-plan-convert",
|
|
44
|
+
number: 4,
|
|
45
|
+
title: "Plan Convert",
|
|
46
|
+
resumeAt: "build-plan-convert",
|
|
47
|
+
},
|
|
48
|
+
{ step: "build-plan-current", number: 5, title: "Plan Current" },
|
|
49
|
+
{ step: "build-install-skills", number: 6, title: "Install Skills" },
|
|
50
|
+
// A group's start commit is recorded before its execute runs: Step 7 again.
|
|
46
51
|
{
|
|
47
52
|
step: "build-group-start",
|
|
48
|
-
number:
|
|
53
|
+
number: 7,
|
|
49
54
|
title: "Plan Execute",
|
|
50
|
-
resumeAt: "build-plan-
|
|
55
|
+
resumeAt: "build-plan-tasks",
|
|
51
56
|
},
|
|
52
|
-
//
|
|
57
|
+
// The group's tests are written before its code: Step 7 resumes at the tests step.
|
|
58
|
+
{ step: "build-plan-tests", number: 7, title: "Plan Execute", resumeAt: "build-plan-tests" },
|
|
59
|
+
// A handover stops a group part-done: Step 7 runs again with a fresh brief.
|
|
53
60
|
{
|
|
54
|
-
step: "build-plan-
|
|
55
|
-
number:
|
|
61
|
+
step: "build-plan-tasks",
|
|
62
|
+
number: 7,
|
|
56
63
|
title: "Plan Execute",
|
|
57
|
-
resumeOnVerdict: { HANDOVER: "build-plan-
|
|
64
|
+
resumeOnVerdict: { HANDOVER: "build-plan-tasks" },
|
|
58
65
|
},
|
|
59
|
-
// Verify, its group gate and the gaps fix route on the verify verdict: Step
|
|
60
|
-
{ step: "build-plan-verify", number:
|
|
61
|
-
{ step: "build-group-gate", number:
|
|
66
|
+
// Verify, its group gate and the gaps fix route on the verify verdict: Step 8 again.
|
|
67
|
+
{ step: "build-plan-verify", number: 8, title: "Plan Verify", resumeAt: "build-plan-verify" },
|
|
68
|
+
{ step: "build-group-gate", number: 8, title: "Plan Verify", resumeAt: "build-plan-verify" },
|
|
62
69
|
{
|
|
63
70
|
step: "build-plan-gaps-remediate",
|
|
64
|
-
number:
|
|
71
|
+
number: 9,
|
|
65
72
|
title: "Plan Gaps Remediate",
|
|
66
73
|
resumeAt: "build-plan-verify",
|
|
67
74
|
},
|
|
68
|
-
{ step: "build-plan-verify-holistic", number:
|
|
69
|
-
// The reports are written: Step
|
|
70
|
-
{ step: "build-challenge", number:
|
|
75
|
+
{ step: "build-plan-verify-holistic", number: 10, title: "Plan Verify Holistic" },
|
|
76
|
+
// The reports are written: Step 11 continues at `bkit challenge merge`.
|
|
77
|
+
{ step: "build-challenge", number: 11, title: "Build Challenge", resumeAt: "build-challenge" },
|
|
71
78
|
// Run Tests routes on its own verdict, and a fix loops back to it.
|
|
72
|
-
{ step: "build-run-tests", number:
|
|
73
|
-
{ step: "build-failure-diagnose", number:
|
|
79
|
+
{ step: "build-run-tests", number: 12, title: "Run Tests", resumeAt: "build-run-tests" },
|
|
80
|
+
{ step: "build-failure-diagnose", number: 13, title: "Failure Diagnose" },
|
|
74
81
|
{
|
|
75
82
|
step: "build-failure-remediate",
|
|
76
|
-
number:
|
|
83
|
+
number: 14,
|
|
77
84
|
title: "Failure Remediate",
|
|
78
85
|
resumeAt: "build-run-tests",
|
|
79
86
|
},
|
|
80
|
-
{ step: "build-summary", number:
|
|
81
|
-
{ step: "build-create-pr", number:
|
|
82
|
-
{ step: "build-close-workflow", number:
|
|
87
|
+
{ step: "build-summary", number: 15, title: "Summary" },
|
|
88
|
+
{ step: "build-create-pr", number: 16, title: "Close Workflow & Create PR" },
|
|
89
|
+
{ step: "build-close-workflow", number: 16, title: "Close Workflow & Create PR" },
|
|
83
90
|
],
|
|
84
91
|
debug: [
|
|
85
92
|
{ step: "debug-start-workflow", number: 1, title: "Start Workflow", setup: true },
|
|
@@ -177,10 +184,10 @@ export const DECISION_ROUTES = {
|
|
|
177
184
|
build: {
|
|
178
185
|
step: "build-decision",
|
|
179
186
|
routes: {
|
|
180
|
-
fix: "build-plan-
|
|
187
|
+
fix: "build-plan-tasks",
|
|
181
188
|
verify: "build-plan-verify",
|
|
182
189
|
tests: "build-run-tests",
|
|
183
|
-
// Try again: a verify loop goes on to its gaps fix (Step
|
|
190
|
+
// Try again: a verify loop goes on to its gaps fix (Step 9), a tests loop to Step 13.
|
|
184
191
|
retry: {
|
|
185
192
|
"build-plan-verify": "build-plan-gaps-remediate",
|
|
186
193
|
"build-group-gate": "build-plan-gaps-remediate",
|
|
@@ -190,7 +197,32 @@ export const DECISION_ROUTES = {
|
|
|
190
197
|
},
|
|
191
198
|
};
|
|
192
199
|
export const isResumable = (w) => w in WORKFLOW_STEPS;
|
|
193
|
-
|
|
200
|
+
/** A completed numbered position, with build groups expanded in plan order. */
|
|
201
|
+
export function runProgress(input) {
|
|
202
|
+
const table = WORKFLOW_STEPS[input.workflow];
|
|
203
|
+
const entry = table.find((s) => input.number === undefined ? s.step === input.step : s.number === input.number);
|
|
204
|
+
if (entry === undefined)
|
|
205
|
+
throw new Error("unknown workflow progress position");
|
|
206
|
+
const steps = new Set(table.map((s) => s.number)).size;
|
|
207
|
+
const groups = input.groups?.length ? input.groups : [1];
|
|
208
|
+
const ordinal = Math.max(1, groups.indexOf(input.group ?? groups[0]) + 1);
|
|
209
|
+
const grouped = input.workflow === "build" && entry.number >= 7 && entry.number <= 9;
|
|
210
|
+
const total = input.workflow === "build" ? 13 + 3 * groups.length : steps;
|
|
211
|
+
const position = input.workflow !== "build" || entry.number < 7
|
|
212
|
+
? entry.number
|
|
213
|
+
: grouped
|
|
214
|
+
? 6 + 3 * (ordinal - 1) + entry.number - 6
|
|
215
|
+
: 6 + 3 * groups.length + entry.number - 9;
|
|
216
|
+
const percent = entry.number === steps ? 100 : Math.min(99, Math.round((100 * position) / total));
|
|
217
|
+
const filled = Math.min(10, Math.max(0, Math.round(percent / 10)));
|
|
218
|
+
let progressLine = `Progress: ${"█".repeat(filled)}${"░".repeat(10 - filled)} ${percent}% · Step ${entry.number}/${steps} ${entry.title}`;
|
|
219
|
+
if (grouped)
|
|
220
|
+
progressLine += ` · Group ${ordinal} of ${groups.length}`;
|
|
221
|
+
if (input.attempt !== undefined && input.attempt > 1)
|
|
222
|
+
progressLine += ` · Attempt ${input.attempt}${input.max === undefined ? "" : ` of ${input.max}`}`;
|
|
223
|
+
return { percent, progressLine };
|
|
224
|
+
}
|
|
225
|
+
const CHALLENGE_ROUTES = new Set(["build-plan-tasks", "build-decision", "build-run-tests"]);
|
|
194
226
|
const roundOf = (s) => {
|
|
195
227
|
const round = Number(s.round);
|
|
196
228
|
return Number.isInteger(round) && round >= 1 ? round : 1;
|
|
@@ -205,7 +237,7 @@ function challengeDone(steps, max) {
|
|
|
205
237
|
/**
|
|
206
238
|
* The build challenge's round, read from the run's `build-challenge` rows (each carries the
|
|
207
239
|
* `round` it ran as; a row without one counts as round 1) and the step row after each: the
|
|
208
|
-
* next of `build-plan-
|
|
240
|
+
* next of `build-plan-tasks` (route fix), `build-decision` (route pause) or
|
|
209
241
|
* `build-run-tests` (route none). A challenge row with no such row after it has not merged
|
|
210
242
|
* yet, so the run keeps that row's round. Otherwise one past the highest round whose merge
|
|
211
243
|
* wrote tasks (route fix or pause), or that ran past round 1; at most `max`
|