@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
|
@@ -217,6 +217,7 @@ export const runtimeCommand: CommandSpec = {
|
|
|
217
217
|
verbs: {
|
|
218
218
|
detect: {
|
|
219
219
|
summary: "Classify the runtime, its default capabilities, gh auth, and the worktree path.",
|
|
220
|
+
use: "by-hand",
|
|
220
221
|
flags: [FID_FLAG],
|
|
221
222
|
output: {
|
|
222
223
|
...TABLE_OUTPUT,
|
|
@@ -234,6 +235,7 @@ export const runtimeCommand: CommandSpec = {
|
|
|
234
235
|
},
|
|
235
236
|
row: {
|
|
236
237
|
summary: "Detect, then build the runtime-resolved row (and append it with --file).",
|
|
238
|
+
use: "workflow",
|
|
237
239
|
flags: [
|
|
238
240
|
WORKFLOW_FLAG,
|
|
239
241
|
{
|
|
@@ -274,6 +276,7 @@ export const runtimeCommand: CommandSpec = {
|
|
|
274
276
|
},
|
|
275
277
|
assert: {
|
|
276
278
|
summary: "Read back the latest runtime-resolved row and fail unless every field is resolved.",
|
|
279
|
+
use: "workflow",
|
|
277
280
|
flags: [
|
|
278
281
|
FILE_FLAG,
|
|
279
282
|
{ ...WORKFLOW_FLAG, required: false, help: "only rows written by this workflow" },
|
|
@@ -4,9 +4,13 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
|
|
6
6
|
import { BKIT_DEBUG_GATES } from "../../install/manifest.js";
|
|
7
|
+
import { appendFrictionRow, journalEnabled, pauseFrictionRow } from "../../ledgers/journal.js";
|
|
8
|
+
import { resolveGitSha } from "../../ledgers/telemetry.js";
|
|
7
9
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
8
10
|
import {
|
|
9
11
|
activeDoneSteps,
|
|
12
|
+
validateCiSelection,
|
|
13
|
+
ciSelectionIdentity,
|
|
10
14
|
allRunsDoneSteps,
|
|
11
15
|
appendLine,
|
|
12
16
|
fold,
|
|
@@ -25,6 +29,7 @@ import {
|
|
|
25
29
|
EXIT,
|
|
26
30
|
git,
|
|
27
31
|
parseJson,
|
|
32
|
+
resolveActiveRun,
|
|
28
33
|
statusLocation,
|
|
29
34
|
type CommandSpec,
|
|
30
35
|
type FlagSpec,
|
|
@@ -58,11 +63,13 @@ export const STEP_FLAG: FlagSpec = {
|
|
|
58
63
|
export const GROUP_FLAG: FlagSpec = {
|
|
59
64
|
name: "group",
|
|
60
65
|
type: "string",
|
|
61
|
-
help: "only rows for this
|
|
66
|
+
help: "only rows for this task group (positive integer)",
|
|
62
67
|
};
|
|
63
68
|
|
|
64
69
|
/** Exit code: status.jsonl missing, unreadable, or not valid NDJSON. */
|
|
65
70
|
export const EXIT_NO_STATUS = 3;
|
|
71
|
+
/** Exit code: the owner-pause friction row was not written; the status row is kept. */
|
|
72
|
+
export const EXIT_PAUSE_FRICTION = 4;
|
|
66
73
|
|
|
67
74
|
/** Every row of status.jsonl, whatever its type; exit 3 when the file is missing or a line is not JSON. */
|
|
68
75
|
export function readStatusRows(file: string): StatusRow[] {
|
|
@@ -90,6 +97,15 @@ export function readStatusRowsAt(file: string, ref: string): StatusRow[] {
|
|
|
90
97
|
return parseStatusRows(text, spec);
|
|
91
98
|
}
|
|
92
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Step names a row may carry from before a rename, read as the current name so a run
|
|
102
|
+
* in flight across the rename folds, resumes and counts as one (`docs/migrations.md`).
|
|
103
|
+
* The row on disk is history and is not rewritten.
|
|
104
|
+
*/
|
|
105
|
+
const RENAMED_STEPS: Readonly<Record<string, string>> = {
|
|
106
|
+
"build-plan-execute": "build-plan-tasks",
|
|
107
|
+
};
|
|
108
|
+
|
|
93
109
|
/** Parse NDJSON status text; `label` names it in errors. Malformed is an error, never "no rows". */
|
|
94
110
|
function parseStatusRows(text: string, label: string): StatusRow[] {
|
|
95
111
|
return text
|
|
@@ -102,7 +118,9 @@ function parseStatusRows(text: string, label: string): StatusRow[] {
|
|
|
102
118
|
if (typeof parsed.value !== "object" || parsed.value === null) {
|
|
103
119
|
throw new CommandError(EXIT_NO_STATUS, `${label} line ${i + 1} is not a JSON object`);
|
|
104
120
|
}
|
|
105
|
-
|
|
121
|
+
const row = parsed.value as StatusRow;
|
|
122
|
+
const renamed = typeof row.step === "string" ? RENAMED_STEPS[row.step] : undefined;
|
|
123
|
+
return renamed === undefined ? row : { ...row, step: renamed };
|
|
106
124
|
});
|
|
107
125
|
}
|
|
108
126
|
|
|
@@ -165,7 +183,14 @@ const DEBUG_MODES = ["NORMAL", "SOAK"];
|
|
|
165
183
|
const PUSH_MODES = ["PR", "LOCAL"];
|
|
166
184
|
const STRATEGIES = ["STANDARD", "PIVOT", "FINAL"];
|
|
167
185
|
|
|
168
|
-
const ROUTE_FIELDS = [
|
|
186
|
+
const ROUTE_FIELDS = [
|
|
187
|
+
"verdict",
|
|
188
|
+
"failures",
|
|
189
|
+
"strategy",
|
|
190
|
+
"debugMode",
|
|
191
|
+
"pushMode",
|
|
192
|
+
"publish",
|
|
193
|
+
] as const;
|
|
169
194
|
type RouteField = (typeof ROUTE_FIELDS)[number];
|
|
170
195
|
|
|
171
196
|
/** Exit code: a `--require`d field is missing or holds a value outside its set. */
|
|
@@ -179,6 +204,8 @@ function route(runs: WorkflowRun[], workflow: string, step: string | undefined,
|
|
|
179
204
|
nextStrategy: null,
|
|
180
205
|
debugMode: null,
|
|
181
206
|
pushMode: null,
|
|
207
|
+
publish: null,
|
|
208
|
+
publishSource: null,
|
|
182
209
|
debugAttempt: 0,
|
|
183
210
|
parentSha: null,
|
|
184
211
|
};
|
|
@@ -223,6 +250,8 @@ function route(runs: WorkflowRun[], workflow: string, step: string | undefined,
|
|
|
223
250
|
value === "" ? `${field} not recorded` : `${field} "${value}" is not ${allowed.join("|")}`;
|
|
224
251
|
}
|
|
225
252
|
|
|
253
|
+
problems.publish = "publish not resolved: needs --workflow=build with --prompt-file";
|
|
254
|
+
|
|
226
255
|
const attempt = Number(lastRun(runs, workflow)?.debugAttempt ?? 0);
|
|
227
256
|
out.debugAttempt = Number.isFinite(attempt) ? attempt : 0;
|
|
228
257
|
return { out, problems };
|
|
@@ -245,13 +274,67 @@ export function debugStart(runs: WorkflowRun[], promptText: string, fixMax: numb
|
|
|
245
274
|
open.steps.some((s) => s.step === "debug-failure-soak" && s.status === "DONE"));
|
|
246
275
|
const fixes = allRunsDoneSteps(runs, "debug", { step: "debug-failure-remediate" }).length;
|
|
247
276
|
const debugMode = promptText.includes("[soak]") || soaking || fixes >= fixMax ? "SOAK" : "NORMAL";
|
|
277
|
+
const selection =
|
|
278
|
+
!promptText.includes("[local]") && validateCiSelection(open?.ciSelection)
|
|
279
|
+
? open.ciSelection
|
|
280
|
+
: null;
|
|
281
|
+
const ci = selection?.mode === "ci" ? selection : null;
|
|
282
|
+
const ciGeneration = typeof open?.ciGeneration === "number" ? open.ciGeneration : 0;
|
|
283
|
+
const current =
|
|
284
|
+
open?.steps.filter((s) => s.status === "DONE" && s.ciGeneration === ciGeneration) ?? [];
|
|
285
|
+
const defaults = promptText.includes("[live=off]")
|
|
286
|
+
? BKIT_DEBUG_GATES.filter((g) => !g.endsWith("-live"))
|
|
287
|
+
: [...BKIT_DEBUG_GATES];
|
|
288
|
+
const covering =
|
|
289
|
+
ci && ci.redTiers.length > 0
|
|
290
|
+
? defaults
|
|
291
|
+
.filter((g) =>
|
|
292
|
+
ci.redTiers.every((tier) => g.slice("bkit:gate:".length).split("-").includes(tier)),
|
|
293
|
+
)
|
|
294
|
+
.reverse()
|
|
295
|
+
: [];
|
|
248
296
|
return {
|
|
249
297
|
debugAttempt: attempt,
|
|
250
298
|
debugMode,
|
|
251
299
|
repro: promptText.includes("[repro]"),
|
|
252
|
-
gates:
|
|
253
|
-
|
|
254
|
-
|
|
300
|
+
gates: [...new Set([...covering, ...defaults])],
|
|
301
|
+
ciRun: ci?.runId ?? null,
|
|
302
|
+
ciGeneration,
|
|
303
|
+
redTiers: ci?.redTiers ?? [],
|
|
304
|
+
ciFixDone:
|
|
305
|
+
ci !== null &&
|
|
306
|
+
current.some((s) => ["debug-failure-remediate", "debug-failure-soak"].includes(s.step)),
|
|
307
|
+
ciReproduced:
|
|
308
|
+
ci !== null &&
|
|
309
|
+
current.some((s) => s.step === "debug-failure-reproduce" && s.reproduced === "YES"),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const PUBLISH_TOKEN = /(?<![\w-])publish=(true|false)(?![\w-])/;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Build's ending, from the session prompt, `bkit.workflows.build.publish` and the runtime.
|
|
317
|
+
* A `publish=true|false` token wins; else LOCAL reads `publish.local` and any other runtime
|
|
318
|
+
* `publish.remote`. A non-LOCAL `false` resolves `true`. No `runtime-resolved` row throws.
|
|
319
|
+
*/
|
|
320
|
+
export function publishRoute(
|
|
321
|
+
rows: StatusRow[],
|
|
322
|
+
promptText: string,
|
|
323
|
+
config: { remote: boolean; local: boolean },
|
|
324
|
+
): { publish: boolean; publishSource: "token" | "local" | "remote" | "coerced" } {
|
|
325
|
+
const row = rows.filter((r) => r.type === "runtime-resolved" && r.workflow === "build").at(-1);
|
|
326
|
+
if (row === undefined)
|
|
327
|
+
throw new CommandError(
|
|
328
|
+
EXIT_ROUTE_MISSING,
|
|
329
|
+
"no runtime-resolved row for build: Step 2 never recorded the runtime",
|
|
330
|
+
);
|
|
331
|
+
const local = row.runtime === "LOCAL";
|
|
332
|
+
const token = PUBLISH_TOKEN.exec(promptText)?.[1];
|
|
333
|
+
const wanted = token !== undefined ? token === "true" : local ? config.local : config.remote;
|
|
334
|
+
if (!local && !wanted) return { publish: true, publishSource: "coerced" };
|
|
335
|
+
return {
|
|
336
|
+
publish: wanted,
|
|
337
|
+
publishSource: token !== undefined ? "token" : local ? "local" : "remote",
|
|
255
338
|
};
|
|
256
339
|
}
|
|
257
340
|
|
|
@@ -308,6 +391,7 @@ export const statusCommand: CommandSpec = {
|
|
|
308
391
|
verbs: {
|
|
309
392
|
path: {
|
|
310
393
|
summary: "Where this workflow's status.jsonl lives.",
|
|
394
|
+
use: "by-hand",
|
|
311
395
|
flags: [
|
|
312
396
|
WORKFLOW_FLAG,
|
|
313
397
|
{ name: "fid", type: "string", required: true, help: "feature id" },
|
|
@@ -334,6 +418,7 @@ export const statusCommand: CommandSpec = {
|
|
|
334
418
|
route: {
|
|
335
419
|
summary:
|
|
336
420
|
"Routing state: last verdict / failures / strategy of a step, debug and push mode; with --prompt-file, debug's start decisions.",
|
|
421
|
+
use: "workflow",
|
|
337
422
|
flags: [
|
|
338
423
|
{ ...FILE_FLAG, required: false, help: `${FILE_FLAG.help}; or --fid and --month` },
|
|
339
424
|
WORKFLOW_FLAG,
|
|
@@ -358,13 +443,19 @@ export const statusCommand: CommandSpec = {
|
|
|
358
443
|
{
|
|
359
444
|
name: "prompt-file",
|
|
360
445
|
type: "string",
|
|
361
|
-
help: "debug
|
|
446
|
+
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",
|
|
362
447
|
},
|
|
363
448
|
{ name: "fid", type: "string", help: "with --prompt-file, in place of --file: feature id" },
|
|
364
449
|
{ name: "month", type: "string", help: "with --prompt-file, in place of --file: YYYYMM" },
|
|
365
450
|
],
|
|
366
451
|
output: {
|
|
367
452
|
verdict: "PASS|CONCERNS|FAIL of the step's last DONE row in the active run, or null",
|
|
453
|
+
ciRun: "active saved CI run ID with --prompt-file, or null; explicit [local] clears it",
|
|
454
|
+
ciGeneration: "active saved selection generation with --prompt-file, or 0",
|
|
455
|
+
redTiers:
|
|
456
|
+
"active selected failed tiers with --prompt-file; empty for local or unknown jobs",
|
|
457
|
+
ciFixDone: "whether the active generation has a DONE remediation or soak",
|
|
458
|
+
ciReproduced: "whether the active generation has DONE reproduction with YES",
|
|
368
459
|
failures:
|
|
369
460
|
"its failures (absent on PASS|CONCERNS = 0, absent on FAIL = null: count unknown), or null",
|
|
370
461
|
strategy: "the step's last strategy across ALL runs, or null",
|
|
@@ -377,6 +468,10 @@ export const statusCommand: CommandSpec = {
|
|
|
377
468
|
repro: "with --prompt-file: [repro] in the prompt",
|
|
378
469
|
gates:
|
|
379
470
|
"with --prompt-file: the gates to try, deepest first; [live=off] in the prompt drops the live gate",
|
|
471
|
+
publish:
|
|
472
|
+
"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",
|
|
473
|
+
publishSource:
|
|
474
|
+
"with publish: token | local | remote | coerced (a non-LOCAL false forced to true), else null",
|
|
380
475
|
parentSha:
|
|
381
476
|
"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",
|
|
382
477
|
},
|
|
@@ -414,8 +509,8 @@ export const statusCommand: CommandSpec = {
|
|
|
414
509
|
}
|
|
415
510
|
}
|
|
416
511
|
const promptFile = str(ctx.flags.promptFile);
|
|
417
|
-
if (promptFile !== undefined && ctx.flags.workflow
|
|
418
|
-
throw new CommandError(EXIT.USAGE, "--prompt-file is for --workflow=debug");
|
|
512
|
+
if (promptFile !== undefined && !["debug", "build"].includes(String(ctx.flags.workflow)))
|
|
513
|
+
throw new CommandError(EXIT.USAGE, "--prompt-file is for --workflow=debug or build");
|
|
419
514
|
const file = routeFile(ctx);
|
|
420
515
|
let promptText = "";
|
|
421
516
|
if (promptFile !== undefined) {
|
|
@@ -433,9 +528,15 @@ export const statusCommand: CommandSpec = {
|
|
|
433
528
|
);
|
|
434
529
|
if (promptFile !== undefined) {
|
|
435
530
|
const root = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
531
|
+
const config = readBkitConfig(root);
|
|
532
|
+
if (ctx.flags.workflow === "debug") {
|
|
533
|
+
Object.assign(out, debugStart(runs, promptText, config.asks["debug.fix"].max));
|
|
534
|
+
delete problems.debugMode;
|
|
535
|
+
} else {
|
|
536
|
+
const rows = fs.existsSync(file) ? readStatusRows(file) : [];
|
|
537
|
+
Object.assign(out, publishRoute(rows, promptText, config.buildPublish));
|
|
538
|
+
delete problems.publish;
|
|
539
|
+
}
|
|
439
540
|
}
|
|
440
541
|
ctx.emit(out);
|
|
441
542
|
const failed = required.filter((r) => problems[r as RouteField] !== undefined);
|
|
@@ -453,6 +554,7 @@ export const statusCommand: CommandSpec = {
|
|
|
453
554
|
resume: {
|
|
454
555
|
summary:
|
|
455
556
|
"The step a stopped run continues at: after its last DONE step, setup steps and retired rows aside.",
|
|
557
|
+
use: "by-hand",
|
|
456
558
|
flags: [
|
|
457
559
|
{ ...FILE_FLAG, help: "path to status.jsonl; a missing file is a run with no rows" },
|
|
458
560
|
{ ...WORKFLOW_FLAG, help: `workflow name: ${Object.keys(WORKFLOW_STEPS).join(", ")}` },
|
|
@@ -462,12 +564,12 @@ export const statusCommand: CommandSpec = {
|
|
|
462
564
|
number: "the step number to continue at (1 when no run is active)",
|
|
463
565
|
title: "the step heading's title",
|
|
464
566
|
after: "the DONE row that placed it, or null",
|
|
465
|
-
group: "that row's
|
|
567
|
+
group: "that row's task group, or null",
|
|
466
568
|
active: "whether the latest run is this workflow, still IN_PROGRESS",
|
|
467
569
|
challengeRound:
|
|
468
|
-
"build: the round Step
|
|
570
|
+
"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",
|
|
469
571
|
challengeDone:
|
|
470
|
-
"build: true once the last allowed challenge round has merged, so Step
|
|
572
|
+
"build: true once the last allowed challenge round has merged, so Step 11 goes on to Step 12; null for other workflows",
|
|
471
573
|
},
|
|
472
574
|
exitCodes: { [EXIT_NO_STATUS]: "status.jsonl unreadable or not valid NDJSON" },
|
|
473
575
|
run: (ctx) => {
|
|
@@ -488,6 +590,7 @@ export const statusCommand: CommandSpec = {
|
|
|
488
590
|
},
|
|
489
591
|
meta: {
|
|
490
592
|
summary: "Append a workflow-meta row (run-level routing state).",
|
|
593
|
+
use: "workflow",
|
|
491
594
|
flags: [
|
|
492
595
|
FILE_FLAG,
|
|
493
596
|
WORKFLOW_FLAG,
|
|
@@ -499,6 +602,11 @@ export const statusCommand: CommandSpec = {
|
|
|
499
602
|
help: "positive integer, or run (the active run's number)",
|
|
500
603
|
},
|
|
501
604
|
{ name: "opened-pr", type: "boolean", help: "record openedPr: this run opened the PR" },
|
|
605
|
+
{
|
|
606
|
+
name: "ci-selection-file",
|
|
607
|
+
type: "string",
|
|
608
|
+
help: "validated atomic debug CI or local selection JSON",
|
|
609
|
+
},
|
|
502
610
|
],
|
|
503
611
|
output: { row: "the appended workflow-meta row" },
|
|
504
612
|
exitCodes: { [EXIT_NO_STATUS]: "status.jsonl does not exist (meta never starts a log)" },
|
|
@@ -506,6 +614,27 @@ export const statusCommand: CommandSpec = {
|
|
|
506
614
|
const file = statusFile(ctx);
|
|
507
615
|
const at = statusTimestamp();
|
|
508
616
|
const fields: Record<string, unknown> = {};
|
|
617
|
+
if (ctx.flags.ciSelectionFile !== undefined) {
|
|
618
|
+
const parsed = parseJson(
|
|
619
|
+
fs.readFileSync(path.resolve(ctx.cwd, String(ctx.flags.ciSelectionFile)), "utf-8"),
|
|
620
|
+
);
|
|
621
|
+
const selection = parsed.ok ? parsed.value : null;
|
|
622
|
+
if (!validateCiSelection(selection))
|
|
623
|
+
throw new CommandError(EXIT.USAGE, "invalid CI selection");
|
|
624
|
+
const active = readRuns(file).at(-1);
|
|
625
|
+
if (
|
|
626
|
+
ctx.flags.workflow !== "debug" ||
|
|
627
|
+
active?.workflow !== "debug" ||
|
|
628
|
+
active.status !== "IN_PROGRESS"
|
|
629
|
+
)
|
|
630
|
+
throw new CommandError(EXIT.USAGE, "CI selection needs an active debug run");
|
|
631
|
+
const same =
|
|
632
|
+
validateCiSelection(active.ciSelection) &&
|
|
633
|
+
ciSelectionIdentity(active.ciSelection) === ciSelectionIdentity(selection);
|
|
634
|
+
fields.ciSelection =
|
|
635
|
+
selection.mode === "local" ? { mode: "local", reason: selection.reason } : selection;
|
|
636
|
+
fields.ciGeneration = (Number(active.ciGeneration) || 0) + (same ? 0 : 1);
|
|
637
|
+
}
|
|
509
638
|
for (const { key, check } of Object.values(META_FIELDS)) {
|
|
510
639
|
const v = str(ctx.flags[key]);
|
|
511
640
|
// `--debug-attempt=run`: the active run's number, read once the log is known to exist.
|
|
@@ -539,7 +668,8 @@ export const statusCommand: CommandSpec = {
|
|
|
539
668
|
},
|
|
540
669
|
row: {
|
|
541
670
|
summary:
|
|
542
|
-
"Append a typed audit row the fold does not model (ship's gate refusals, CI probes, merge CI).",
|
|
671
|
+
"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.",
|
|
672
|
+
use: "workflow",
|
|
543
673
|
flags: [
|
|
544
674
|
FILE_FLAG,
|
|
545
675
|
WORKFLOW_FLAG,
|
|
@@ -557,7 +687,11 @@ export const statusCommand: CommandSpec = {
|
|
|
557
687
|
},
|
|
558
688
|
],
|
|
559
689
|
output: { row: "the appended row" },
|
|
560
|
-
exitCodes: {
|
|
690
|
+
exitCodes: {
|
|
691
|
+
[EXIT_NO_STATUS]: "status.jsonl does not exist (a row never starts a log)",
|
|
692
|
+
[EXIT_PAUSE_FRICTION]:
|
|
693
|
+
"an owner-pause row was appended but its human-confirm friction row was not written",
|
|
694
|
+
},
|
|
561
695
|
run: (ctx) => {
|
|
562
696
|
const type = String(ctx.flags.type);
|
|
563
697
|
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(type))
|
|
@@ -581,10 +715,59 @@ export const statusCommand: CommandSpec = {
|
|
|
581
715
|
at: statusTimestamp(),
|
|
582
716
|
...fields,
|
|
583
717
|
};
|
|
718
|
+
const prior = type === "owner-pause" ? fs.readFileSync(file, "utf-8") : "";
|
|
584
719
|
fs.appendFileSync(file, appendLine(row));
|
|
720
|
+
if (type === "owner-pause") recordPause(ctx.cwd, file, row, prior);
|
|
585
721
|
ctx.emit({ row });
|
|
586
722
|
return EXIT.OK;
|
|
587
723
|
},
|
|
588
724
|
},
|
|
589
725
|
},
|
|
590
726
|
};
|
|
727
|
+
|
|
728
|
+
const pauseReason = (row: Record<string, unknown>) =>
|
|
729
|
+
row["reason"] === undefined ? undefined : String(row["reason"]);
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Log an owner pause as `human-confirm` friction in the active run's books. A
|
|
733
|
+
* follow-up wait writes nothing: `prior` (the status file before this row) holds an
|
|
734
|
+
* `owner-pause` row with the same workflow and reason and no `step-done` row after it.
|
|
735
|
+
* Nothing is written outside an active run or with `BKIT_ENGINE_JOURNAL=off`.
|
|
736
|
+
*/
|
|
737
|
+
function recordPause(
|
|
738
|
+
cwd: string,
|
|
739
|
+
file: string,
|
|
740
|
+
row: StatusRow & { workflow: string },
|
|
741
|
+
prior: string,
|
|
742
|
+
) {
|
|
743
|
+
if (!journalEnabled()) return;
|
|
744
|
+
const reason = pauseReason(row);
|
|
745
|
+
let waiting = false;
|
|
746
|
+
for (const line of prior.split("\n")) {
|
|
747
|
+
const parsed = parseJson(line);
|
|
748
|
+
if (!parsed.ok || parsed.value === null || typeof parsed.value !== "object") continue;
|
|
749
|
+
const r = parsed.value as Record<string, unknown>;
|
|
750
|
+
if (r["type"] === "step-done") waiting = false;
|
|
751
|
+
else if (r["type"] === "owner-pause" && r["workflow"] === row.workflow) {
|
|
752
|
+
waiting ||= pauseReason(r) === reason;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
if (waiting) return;
|
|
756
|
+
const run = resolveActiveRun({ cwd, file });
|
|
757
|
+
if (run === undefined) return;
|
|
758
|
+
const wrote = appendFrictionRow(
|
|
759
|
+
run.bookRoot,
|
|
760
|
+
pauseFrictionRow({
|
|
761
|
+
workflow: row.workflow,
|
|
762
|
+
reason,
|
|
763
|
+
bookRoot: run.bookRoot,
|
|
764
|
+
parentSha: resolveGitSha("HEAD", run.bookRoot),
|
|
765
|
+
}),
|
|
766
|
+
);
|
|
767
|
+
if (!wrote.ok) {
|
|
768
|
+
throw new CommandError(
|
|
769
|
+
EXIT_PAUSE_FRICTION,
|
|
770
|
+
`owner-pause row kept; its friction row was not written: ${wrote.error}`,
|
|
771
|
+
);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
@@ -51,55 +51,62 @@ export const WORKFLOW_STEPS: Readonly<Record<ResumableWorkflow, readonly Workflo
|
|
|
51
51
|
{ step: "design-apply-review", number: 8, title: "Apply Review" },
|
|
52
52
|
{ step: "design-organise", number: 9, title: "Design Organise" },
|
|
53
53
|
{ step: "design-summary", number: 10, title: "Summary" },
|
|
54
|
-
{ step: "design-workstream-suggest", number: 11, title: "Suggest
|
|
54
|
+
{ step: "design-workstream-suggest", number: 11, title: "Suggest Plans" },
|
|
55
55
|
{ step: "design-close-workflow", number: 12, title: "Close Workflow" },
|
|
56
56
|
],
|
|
57
57
|
build: [
|
|
58
58
|
{ step: "build-start-workflow", number: 1, title: "Start Workflow", setup: true },
|
|
59
59
|
{ step: "build-worktree-setup", number: 2, title: "Worktree Setup", setup: true },
|
|
60
|
-
// A converted plan is checked again: Step 3 runs its plan check once more.
|
|
61
|
-
{ step: "build-plan-convert", number: 3, title: "Branch Sync", resumeAt: "build-branch-sync" },
|
|
62
60
|
{ step: "build-branch-sync", number: 3, title: "Branch Sync" },
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
|
|
61
|
+
// A converted plan is checked again: Step 4 runs its plan check once more.
|
|
62
|
+
{
|
|
63
|
+
step: "build-plan-convert",
|
|
64
|
+
number: 4,
|
|
65
|
+
title: "Plan Convert",
|
|
66
|
+
resumeAt: "build-plan-convert",
|
|
67
|
+
},
|
|
68
|
+
{ step: "build-plan-current", number: 5, title: "Plan Current" },
|
|
69
|
+
{ step: "build-install-skills", number: 6, title: "Install Skills" },
|
|
70
|
+
// A group's start commit is recorded before its execute runs: Step 7 again.
|
|
66
71
|
{
|
|
67
72
|
step: "build-group-start",
|
|
68
|
-
number:
|
|
73
|
+
number: 7,
|
|
69
74
|
title: "Plan Execute",
|
|
70
|
-
resumeAt: "build-plan-
|
|
75
|
+
resumeAt: "build-plan-tasks",
|
|
71
76
|
},
|
|
72
|
-
//
|
|
77
|
+
// The group's tests are written before its code: Step 7 resumes at the tests step.
|
|
78
|
+
{ step: "build-plan-tests", number: 7, title: "Plan Execute", resumeAt: "build-plan-tests" },
|
|
79
|
+
// A handover stops a group part-done: Step 7 runs again with a fresh brief.
|
|
73
80
|
{
|
|
74
|
-
step: "build-plan-
|
|
75
|
-
number:
|
|
81
|
+
step: "build-plan-tasks",
|
|
82
|
+
number: 7,
|
|
76
83
|
title: "Plan Execute",
|
|
77
|
-
resumeOnVerdict: { HANDOVER: "build-plan-
|
|
84
|
+
resumeOnVerdict: { HANDOVER: "build-plan-tasks" },
|
|
78
85
|
},
|
|
79
|
-
// Verify, its group gate and the gaps fix route on the verify verdict: Step
|
|
80
|
-
{ step: "build-plan-verify", number:
|
|
81
|
-
{ step: "build-group-gate", number:
|
|
86
|
+
// Verify, its group gate and the gaps fix route on the verify verdict: Step 8 again.
|
|
87
|
+
{ step: "build-plan-verify", number: 8, title: "Plan Verify", resumeAt: "build-plan-verify" },
|
|
88
|
+
{ step: "build-group-gate", number: 8, title: "Plan Verify", resumeAt: "build-plan-verify" },
|
|
82
89
|
{
|
|
83
90
|
step: "build-plan-gaps-remediate",
|
|
84
|
-
number:
|
|
91
|
+
number: 9,
|
|
85
92
|
title: "Plan Gaps Remediate",
|
|
86
93
|
resumeAt: "build-plan-verify",
|
|
87
94
|
},
|
|
88
|
-
{ step: "build-plan-verify-holistic", number:
|
|
89
|
-
// The reports are written: Step
|
|
90
|
-
{ step: "build-challenge", number:
|
|
95
|
+
{ step: "build-plan-verify-holistic", number: 10, title: "Plan Verify Holistic" },
|
|
96
|
+
// The reports are written: Step 11 continues at `bkit challenge merge`.
|
|
97
|
+
{ step: "build-challenge", number: 11, title: "Build Challenge", resumeAt: "build-challenge" },
|
|
91
98
|
// Run Tests routes on its own verdict, and a fix loops back to it.
|
|
92
|
-
{ step: "build-run-tests", number:
|
|
93
|
-
{ step: "build-failure-diagnose", number:
|
|
99
|
+
{ step: "build-run-tests", number: 12, title: "Run Tests", resumeAt: "build-run-tests" },
|
|
100
|
+
{ step: "build-failure-diagnose", number: 13, title: "Failure Diagnose" },
|
|
94
101
|
{
|
|
95
102
|
step: "build-failure-remediate",
|
|
96
|
-
number:
|
|
103
|
+
number: 14,
|
|
97
104
|
title: "Failure Remediate",
|
|
98
105
|
resumeAt: "build-run-tests",
|
|
99
106
|
},
|
|
100
|
-
{ step: "build-summary", number:
|
|
101
|
-
{ step: "build-create-pr", number:
|
|
102
|
-
{ step: "build-close-workflow", number:
|
|
107
|
+
{ step: "build-summary", number: 15, title: "Summary" },
|
|
108
|
+
{ step: "build-create-pr", number: 16, title: "Close Workflow & Create PR" },
|
|
109
|
+
{ step: "build-close-workflow", number: 16, title: "Close Workflow & Create PR" },
|
|
103
110
|
],
|
|
104
111
|
debug: [
|
|
105
112
|
{ step: "debug-start-workflow", number: 1, title: "Start Workflow", setup: true },
|
|
@@ -206,10 +213,10 @@ export const DECISION_ROUTES: Readonly<
|
|
|
206
213
|
build: {
|
|
207
214
|
step: "build-decision",
|
|
208
215
|
routes: {
|
|
209
|
-
fix: "build-plan-
|
|
216
|
+
fix: "build-plan-tasks",
|
|
210
217
|
verify: "build-plan-verify",
|
|
211
218
|
tests: "build-run-tests",
|
|
212
|
-
// Try again: a verify loop goes on to its gaps fix (Step
|
|
219
|
+
// Try again: a verify loop goes on to its gaps fix (Step 9), a tests loop to Step 13.
|
|
213
220
|
retry: {
|
|
214
221
|
"build-plan-verify": "build-plan-gaps-remediate",
|
|
215
222
|
"build-group-gate": "build-plan-gaps-remediate",
|
|
@@ -221,6 +228,41 @@ export const DECISION_ROUTES: Readonly<
|
|
|
221
228
|
|
|
222
229
|
export const isResumable = (w: string): w is ResumableWorkflow => w in WORKFLOW_STEPS;
|
|
223
230
|
|
|
231
|
+
/** A completed numbered position, with build groups expanded in plan order. */
|
|
232
|
+
export function runProgress(input: {
|
|
233
|
+
workflow: ResumableWorkflow;
|
|
234
|
+
step?: string;
|
|
235
|
+
number?: number;
|
|
236
|
+
groups?: number[];
|
|
237
|
+
group?: number;
|
|
238
|
+
attempt?: number;
|
|
239
|
+
max?: number;
|
|
240
|
+
}): { percent: number; progressLine: string } {
|
|
241
|
+
const table = WORKFLOW_STEPS[input.workflow];
|
|
242
|
+
const entry = table.find((s) =>
|
|
243
|
+
input.number === undefined ? s.step === input.step : s.number === input.number,
|
|
244
|
+
);
|
|
245
|
+
if (entry === undefined) throw new Error("unknown workflow progress position");
|
|
246
|
+
const steps = new Set(table.map((s) => s.number)).size;
|
|
247
|
+
const groups = input.groups?.length ? input.groups : [1];
|
|
248
|
+
const ordinal = Math.max(1, groups.indexOf(input.group ?? groups[0]!) + 1);
|
|
249
|
+
const grouped = input.workflow === "build" && entry.number >= 7 && entry.number <= 9;
|
|
250
|
+
const total = input.workflow === "build" ? 13 + 3 * groups.length : steps;
|
|
251
|
+
const position =
|
|
252
|
+
input.workflow !== "build" || entry.number < 7
|
|
253
|
+
? entry.number
|
|
254
|
+
: grouped
|
|
255
|
+
? 6 + 3 * (ordinal - 1) + entry.number - 6
|
|
256
|
+
: 6 + 3 * groups.length + entry.number - 9;
|
|
257
|
+
const percent = entry.number === steps ? 100 : Math.min(99, Math.round((100 * position) / total));
|
|
258
|
+
const filled = Math.min(10, Math.max(0, Math.round(percent / 10)));
|
|
259
|
+
let progressLine = `Progress: ${"█".repeat(filled)}${"░".repeat(10 - filled)} ${percent}% · Step ${entry.number}/${steps} ${entry.title}`;
|
|
260
|
+
if (grouped) progressLine += ` · Group ${ordinal} of ${groups.length}`;
|
|
261
|
+
if (input.attempt !== undefined && input.attempt > 1)
|
|
262
|
+
progressLine += ` · Attempt ${input.attempt}${input.max === undefined ? "" : ` of ${input.max}`}`;
|
|
263
|
+
return { percent, progressLine };
|
|
264
|
+
}
|
|
265
|
+
|
|
224
266
|
export interface ResumePoint {
|
|
225
267
|
/** The step to continue at: its row name (null for a step that writes no row), number and title. */
|
|
226
268
|
step: string | null;
|
|
@@ -228,17 +270,17 @@ export interface ResumePoint {
|
|
|
228
270
|
title: string;
|
|
229
271
|
/** The DONE row that placed the point, or null when none did (resume at Step 1). */
|
|
230
272
|
after: string | null;
|
|
231
|
-
/** That row's
|
|
273
|
+
/** That row's task group, or null. */
|
|
232
274
|
group: number | null;
|
|
233
275
|
/** Whether the latest run is this workflow, still IN_PROGRESS. */
|
|
234
276
|
active: boolean;
|
|
235
|
-
/** Build only (null otherwise): the round Step
|
|
277
|
+
/** Build only (null otherwise): the round Step 11's challenge runs as — see `challengeRound`. */
|
|
236
278
|
challengeRound: number | null;
|
|
237
|
-
/** Build only (null otherwise): the last allowed round has merged, so Step
|
|
279
|
+
/** Build only (null otherwise): the last allowed round has merged, so Step 11 goes on to Step 12. */
|
|
238
280
|
challengeDone: boolean | null;
|
|
239
281
|
}
|
|
240
282
|
|
|
241
|
-
const CHALLENGE_ROUTES = new Set(["build-plan-
|
|
283
|
+
const CHALLENGE_ROUTES = new Set(["build-plan-tasks", "build-decision", "build-run-tests"]);
|
|
242
284
|
const roundOf = (s: WorkflowRun["steps"][number]): number => {
|
|
243
285
|
const round = Number((s as { round?: unknown }).round);
|
|
244
286
|
return Number.isInteger(round) && round >= 1 ? round : 1;
|
|
@@ -261,7 +303,7 @@ function challengeDone(steps: WorkflowRun["steps"], max: number): boolean {
|
|
|
261
303
|
/**
|
|
262
304
|
* The build challenge's round, read from the run's `build-challenge` rows (each carries the
|
|
263
305
|
* `round` it ran as; a row without one counts as round 1) and the step row after each: the
|
|
264
|
-
* next of `build-plan-
|
|
306
|
+
* next of `build-plan-tasks` (route fix), `build-decision` (route pause) or
|
|
265
307
|
* `build-run-tests` (route none). A challenge row with no such row after it has not merged
|
|
266
308
|
* yet, so the run keeps that row's round. Otherwise one past the highest round whose merge
|
|
267
309
|
* wrote tasks (route fix or pause), or that ran past round 1; at most `max`
|
|
@@ -327,7 +369,7 @@ export function resumePoint(
|
|
|
327
369
|
return at(byStep.get(routed)!, last.step, prior?.group ?? prior?.subPlan ?? null);
|
|
328
370
|
}
|
|
329
371
|
const group = last.group ?? last.subPlan ?? null;
|
|
330
|
-
const verdict = String(
|
|
372
|
+
const verdict = String(last.verdict);
|
|
331
373
|
const target =
|
|
332
374
|
retired[last.step] ??
|
|
333
375
|
byStep.get(last.step)!.resumeOnVerdict?.[verdict] ??
|