@rt-tools/agent-kit 0.37.0 → 0.38.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/README.md +5 -5
- package/assets/checks/action-of.mjs +154 -0
- package/assets/checks/board-pull-state.github.mjs +82 -13
- package/assets/checks/board-runs.github.mjs +40 -5
- package/assets/checks/board.github.mjs +1 -1
- package/assets/checks/check-board.github.mjs +58 -19
- package/assets/checks/check-specs.mjs +2 -2
- package/assets/checks/check-state-next.mjs +22 -10
- package/assets/checks/check-turn-map.mjs +26 -6
- package/assets/checks/check-work-steps.mjs +4 -173
- package/assets/checks/decide.mjs +285 -0
- package/assets/checks/decision-table.json +21365 -0
- package/assets/checks/decision-table.mjs +495 -0
- package/assets/checks/epic-table.github.mjs +4 -3
- package/assets/checks/epic-window.mjs +98 -0
- package/assets/checks/flow-condition.mjs +64 -0
- package/assets/checks/flow-data.mjs +136 -0
- package/assets/checks/flow-forecast.mjs +330 -0
- package/assets/checks/flow-guard-run.mjs +90 -0
- package/assets/checks/flow-guard.mjs +294 -0
- package/assets/checks/flow-model.mjs +271 -0
- package/assets/checks/flow-override.mjs +130 -0
- package/assets/checks/flow-plan.mjs +206 -0
- package/assets/checks/flow-scaffold.mjs +224 -0
- package/assets/checks/flow-step.mjs +365 -0
- package/assets/checks/flow-sync.mjs +296 -0
- package/assets/checks/flow-syntax.mjs +292 -0
- package/assets/checks/flow-verdict.mjs +112 -0
- package/assets/checks/lib-common.mjs +10 -2
- package/assets/checks/lib-domains.mjs +1 -1
- package/assets/checks/lib-manifests.mjs +34 -2
- package/assets/checks/merge-read.mjs +239 -0
- package/assets/checks/owner-nudges.mjs +389 -0
- package/assets/checks/push-inputs.mjs +444 -0
- package/assets/checks/push-trace.mjs +108 -0
- package/assets/checks/record-count.mjs +410 -0
- package/assets/checks/record-recount.mjs +187 -0
- package/assets/checks/record-turn.mjs +155 -0
- package/assets/checks/rt-kit-checks.config.mjs +17 -2
- package/assets/checks/spec-anchors.mjs +4 -4
- package/assets/checks/spec-contract.mjs +5 -5
- package/assets/checks/task-flow-script.mjs +292 -0
- package/assets/checks/tree-assignment.mjs +26 -7
- package/assets/checks/work-result.mjs +281 -0
- package/assets/checks/work-steps-lib.mjs +205 -0
- package/assets/commands/next-session.md +3 -1
- package/assets/commands/night.md +28 -18
- package/assets/defaults/gate-map.sh +39 -12
- package/assets/defaults/merges.sh +48 -0
- package/assets/defaults/project.sh +43 -13
- package/assets/defaults/push.sh +23 -0
- package/assets/defaults/turn-map.md +24 -21
- package/assets/docs/GLOSSARY.md +6 -2
- package/assets/hooks/ask-judge.md +65 -0
- package/assets/hooks/browser-guard-device-id.sh +11 -9
- package/assets/hooks/browser-guard-no-asking.sh +12 -6
- package/assets/hooks/browser-guard-no-listing.sh +13 -7
- package/assets/hooks/browser-guard-no-other-drivers.sh +25 -17
- package/assets/hooks/browser-guard-require-select.sh +15 -15
- package/assets/hooks/commit-msg.sh +13 -3
- package/assets/hooks/conscience-guard.sh +9 -25
- package/assets/hooks/decide.sh +141 -0
- package/assets/hooks/deny-tail.sh +16 -11
- package/assets/hooks/dev-server-guard.sh +27 -20
- package/assets/hooks/dispatch.sh +47 -4
- package/assets/hooks/docs-guard.sh +31 -200
- package/assets/hooks/end-conversation-guard.sh +12 -21
- package/assets/hooks/epic-stop-guard.sh +54 -105
- package/assets/hooks/exam-guard.sh +32 -65
- package/assets/hooks/facts-docs.sh +221 -0
- package/assets/hooks/facts-flow.sh +173 -0
- package/assets/hooks/facts.sh +308 -0
- package/assets/hooks/flow-step-guard.sh +93 -0
- package/assets/hooks/git-guard-delivery-body.sh +4 -4
- package/assets/hooks/git-guard-delivery-conflict.sh +16 -10
- package/assets/hooks/git-guard-delivery-draft.sh +3 -3
- package/assets/hooks/git-guard-delivery-epic.sh +18 -9
- package/assets/hooks/git-guard-delivery-folder.sh +32 -7
- package/assets/hooks/git-guard-delivery-merge.sh +2 -2
- package/assets/hooks/git-guard-delivery-merged.sh +12 -1
- package/assets/hooks/git-guard-delivery-pipeline.sh +1 -1
- package/assets/hooks/git-guard-delivery-rerun.sh +32 -0
- package/assets/hooks/git-guard-delivery-signature.sh +82 -45
- package/assets/hooks/git-guard-delivery-task.sh +47 -0
- package/assets/hooks/git-guard-delivery.sh +112 -101
- package/assets/hooks/git-guard-discard.sh +8 -18
- package/assets/hooks/git-guard-main.sh +13 -19
- package/assets/hooks/git-guard-no-verify.sh +56 -16
- package/assets/hooks/git-guard-push-ahead.sh +46 -5
- package/assets/hooks/git-guard-push-marks.sh +227 -31
- package/assets/hooks/git-guard-push-tests.sh +51 -53
- package/assets/hooks/git-guard-tree-assignment.sh +7 -4
- package/assets/hooks/guard-note.sh +8 -6
- package/assets/hooks/handoff-entry-guard.sh +20 -39
- package/assets/hooks/handoff-write.sh +3 -1
- package/assets/hooks/hook-input.sh +0 -41
- package/assets/hooks/metric-marks.sh +19 -7
- package/assets/hooks/observe.sh +1 -1
- package/assets/hooks/override-write-guard.sh +27 -9
- package/assets/hooks/pre-push.sh +20 -10
- package/assets/hooks/prose-style-guard.sh +6 -19
- package/assets/hooks/pull-merges.sh +76 -0
- package/assets/hooks/push-set.sh +39 -7
- package/assets/hooks/qa-dataid-guard.sh +7 -17
- package/assets/hooks/record-turn.sh +52 -0
- package/assets/hooks/rerun-guard.sh +11 -16
- package/assets/hooks/reuse-first-guard.sh +7 -21
- package/assets/hooks/role-calls.sh +25 -3
- package/assets/hooks/rule-source-guard.sh +54 -21
- package/assets/hooks/skill-gate-rearm.sh +18 -5
- package/assets/hooks/skill-gate.sh +156 -20
- package/assets/hooks/skill-loaded.sh +18 -3
- package/assets/hooks/sql-guard-target.sh +2 -2
- package/assets/hooks/sql-guard-write.sh +12 -12
- package/assets/hooks/sql-guard.sh +58 -16
- package/assets/hooks/task-context-load.sh +3 -1
- package/assets/hooks/task-flow-context.sh +20 -22
- package/assets/hooks/task-flow-draft-guard.sh +25 -74
- package/assets/hooks/task-flow-guard.sh +28 -129
- package/assets/hooks/tree-assignment-guard.sh +25 -14
- package/assets/hooks/turn-entry-load.sh +3 -1
- package/assets/hooks/turn-exit-guard.sh +92 -452
- package/assets/hooks/turn-exit-role.sh +47 -0
- package/assets/hooks/turn-judge.md +103 -0
- package/assets/hooks/window-fill-guard.sh +22 -41
- package/assets/laws/work-conduct.md +9 -8
- package/assets/patterns/autonomous-work-run.md +35 -10
- package/assets/patterns/browser-verification-measure.md +10 -20
- package/assets/patterns/browser-verification-stand.md +30 -42
- package/assets/patterns/doc-style-human.md +0 -6
- package/assets/patterns/doc-style-sweep.md +7 -7
- package/assets/patterns/doc-style-trace.md +5 -4
- package/assets/patterns/doc-style-write.md +7 -7
- package/assets/patterns/epic-flow-declare.md +15 -8
- package/assets/patterns/git-workflow-commit.azure.md +9 -155
- package/assets/patterns/git-workflow-commit.github.md +11 -269
- package/assets/patterns/git-workflow-commit.gitlab.md +9 -161
- package/assets/patterns/git-workflow-docker.md +8 -231
- package/assets/patterns/git-workflow-freshness.md +9 -56
- package/assets/patterns/git-workflow-merge.md +7 -174
- package/assets/patterns/git-workflow-migration.md +5 -73
- package/assets/patterns/git-workflow-pr-body.github.md +6 -159
- package/assets/patterns/git-workflow-pr-ready.md +9 -69
- package/assets/patterns/git-workflow-pr.azure.md +14 -220
- package/assets/patterns/git-workflow-pr.github.md +13 -253
- package/assets/patterns/git-workflow-pr.gitlab.md +14 -241
- package/assets/patterns/git-workflow-restart.md +5 -41
- package/assets/patterns/git-workflow-secrets.md +10 -76
- package/assets/patterns/git-workflow-stack.md +9 -205
- package/assets/patterns/lib-layers-new.md +7 -3
- package/assets/patterns/queue-audit-read.github.md +9 -3
- package/assets/patterns/spec-driven-domain.md +50 -48
- package/assets/patterns/spec-driven-rule.md +18 -19
- package/assets/patterns/status-report-table.github.md +2 -2
- package/assets/patterns/task-flow-archive.md +15 -256
- package/assets/patterns/task-flow-close.md +16 -291
- package/assets/patterns/task-flow-cycle.md +13 -39
- package/assets/patterns/task-flow-graph.needs-graph.md +8 -58
- package/assets/patterns/task-flow-handoff.md +13 -161
- package/assets/patterns/task-flow-resume.md +19 -183
- package/assets/patterns/task-flow-start.md +9 -248
- package/assets/patterns/testing-e2e.md +14 -18
- package/assets/patterns/testing-unit.md +9 -13
- package/assets/patterns/turn-entry-map.md +15 -5
- package/assets/pitfalls/agent-kit-extend.md +200 -0
- package/assets/pitfalls/agent-kit.2.md +323 -0
- package/assets/pitfalls/angular-patterns.md +98 -0
- package/assets/pitfalls/autonomous-work.md +15 -0
- package/assets/pitfalls/browser-verification.md +265 -0
- package/assets/pitfalls/component-structure.md +98 -0
- package/assets/pitfalls/dependencies.md +92 -0
- package/assets/pitfalls/deploy-flow.azure.md +171 -0
- package/assets/pitfalls/deploy-flow.github.md +211 -0
- package/assets/pitfalls/deploy-flow.gitlab.md +173 -0
- package/assets/pitfalls/doc-style.2.md +286 -0
- package/assets/pitfalls/doc-style.md +3 -3
- package/assets/pitfalls/entity-conventions.needs-admin.md +96 -0
- package/assets/pitfalls/entity-models.md +89 -0
- package/assets/pitfalls/git-workflow-commit.azure.md +190 -0
- package/assets/pitfalls/git-workflow-commit.github.md +307 -0
- package/assets/pitfalls/git-workflow-commit.gitlab.md +196 -0
- package/assets/pitfalls/git-workflow-docker.md +275 -0
- package/assets/pitfalls/git-workflow-freshness.md +88 -0
- package/assets/pitfalls/git-workflow-hosting.azure.md +31 -0
- package/assets/pitfalls/git-workflow-hosting.github.md +32 -0
- package/assets/pitfalls/git-workflow-hosting.gitlab.md +31 -0
- package/assets/pitfalls/git-workflow-merge.md +220 -0
- package/assets/pitfalls/git-workflow-migration.md +103 -0
- package/assets/pitfalls/git-workflow-pr-body.github.md +185 -0
- package/assets/pitfalls/git-workflow-pr-ready.md +104 -0
- package/assets/pitfalls/git-workflow-pr.2.azure.md +172 -0
- package/assets/pitfalls/git-workflow-pr.2.github.md +184 -0
- package/assets/pitfalls/git-workflow-pr.2.gitlab.md +180 -0
- package/assets/pitfalls/git-workflow-pr.azure.md +159 -0
- package/assets/pitfalls/git-workflow-pr.github.md +107 -0
- package/assets/pitfalls/git-workflow-pr.gitlab.md +151 -0
- package/assets/pitfalls/git-workflow-push.azure.md +30 -0
- package/assets/pitfalls/git-workflow-push.github.md +30 -0
- package/assets/pitfalls/git-workflow-push.gitlab.md +30 -0
- package/assets/pitfalls/git-workflow-queue.azure.md +30 -0
- package/assets/pitfalls/git-workflow-queue.github.md +30 -0
- package/assets/pitfalls/git-workflow-queue.gitlab.md +30 -0
- package/assets/pitfalls/git-workflow-restart.md +72 -0
- package/assets/pitfalls/git-workflow-secrets.md +114 -0
- package/assets/pitfalls/git-workflow-stack.md +254 -0
- package/assets/pitfalls/git-workflow.2.azure.md +291 -0
- package/assets/pitfalls/git-workflow.2.github.md +294 -0
- package/assets/pitfalls/git-workflow.2.gitlab.md +278 -0
- package/assets/pitfalls/git-workflow.github.md +5 -9
- package/assets/pitfalls/lib-layers.md +114 -0
- package/assets/pitfalls/lists.md +117 -0
- package/assets/pitfalls/navigation.md +94 -0
- package/assets/pitfalls/reuse-first.md +201 -0
- package/assets/pitfalls/spec-driven.2.md +318 -0
- package/assets/pitfalls/spec-driven.md +9 -7
- package/assets/pitfalls/styling-bem.2.md +125 -0
- package/assets/pitfalls/task-flow-archive.md +264 -0
- package/assets/pitfalls/task-flow-close.2.md +165 -0
- package/assets/pitfalls/task-flow-close.md +167 -0
- package/assets/pitfalls/task-flow-cycle.md +73 -0
- package/assets/pitfalls/task-flow-graph.needs-graph.md +98 -0
- package/assets/pitfalls/task-flow-handoff.md +200 -0
- package/assets/pitfalls/task-flow-handover.md +30 -0
- package/assets/pitfalls/task-flow-owner.md +29 -0
- package/assets/pitfalls/task-flow-plan.md +29 -0
- package/assets/pitfalls/task-flow-resume.md +257 -0
- package/assets/pitfalls/task-flow-start.md +287 -0
- package/assets/pitfalls/task-flow.2.md +303 -0
- package/assets/pitfalls/task-flow.md +18 -29
- package/assets/pitfalls/testing.2.md +279 -0
- package/assets/pitfalls/testing.md +11 -12
- package/assets/pitfalls/turn-conduct.md +17 -18
- package/assets/pitfalls/typescript-conventions.md +161 -0
- package/assets/pitfalls/write-a-skill.md +128 -0
- package/assets/rules/angular-patterns.md +21 -86
- package/assets/rules/autonomous-work.md +37 -29
- package/assets/rules/browser-verification.md +28 -251
- package/assets/rules/component-structure.md +25 -87
- package/assets/rules/dependencies.md +20 -78
- package/assets/rules/deploy-flow.azure.md +27 -134
- package/assets/rules/deploy-flow.github.md +34 -196
- package/assets/rules/deploy-flow.gitlab.md +28 -137
- package/assets/rules/doc-style.md +32 -282
- package/assets/rules/entity-conventions.needs-admin.md +26 -82
- package/assets/rules/entity-models.md +14 -63
- package/assets/rules/epic-flow.md +5 -3
- package/assets/rules/git-workflow-hosting.azure.md +26 -0
- package/assets/rules/git-workflow-hosting.github.md +38 -0
- package/assets/rules/git-workflow-hosting.gitlab.md +27 -0
- package/assets/rules/git-workflow-push.azure.md +28 -0
- package/assets/rules/git-workflow-push.github.md +28 -0
- package/assets/rules/git-workflow-push.gitlab.md +28 -0
- package/assets/rules/git-workflow-queue.azure.md +23 -0
- package/assets/rules/git-workflow-queue.github.md +30 -0
- package/assets/rules/git-workflow-queue.gitlab.md +23 -0
- package/assets/rules/git-workflow.azure.md +21 -264
- package/assets/rules/git-workflow.github.md +24 -285
- package/assets/rules/git-workflow.gitlab.md +21 -258
- package/assets/rules/lib-layers.md +30 -103
- package/assets/rules/lists.md +21 -105
- package/assets/rules/navigation.md +10 -69
- package/assets/rules/queue-audit.github.md +5 -3
- package/assets/rules/reuse-first.md +20 -195
- package/assets/rules/spec-driven.md +35 -316
- package/assets/rules/status-report.md +5 -3
- package/assets/rules/styling-bem.md +20 -117
- package/assets/rules/task-flow-handover.md +24 -0
- package/assets/rules/task-flow-owner.md +34 -0
- package/assets/rules/task-flow-plan.md +38 -0
- package/assets/rules/task-flow.md +22 -289
- package/assets/rules/testing.md +32 -270
- package/assets/rules/turn-conduct.md +109 -111
- package/assets/rules/turn-entry.md +2 -2
- package/assets/rules/typescript-conventions.md +41 -147
- package/assets/samples/tasks/_template/plan.md +30 -6
- package/assets/samples/tasks/_template/progress.md +0 -1
- package/assets/skills/agent-kit-extend.md +25 -168
- package/assets/skills/agent-kit.md +27 -299
- package/assets/skills/write-a-skill.md +20 -106
- package/assets/task-flow/flow.js +188 -0
- package/assets/task-flow/flow.md +102 -0
- package/assets/task-flow/measure/agreement.mjs +24 -0
- package/assets/task-flow/measure/copy.mjs +22 -0
- package/assets/task-flow/measure/epic-of.mjs +50 -0
- package/assets/task-flow/measure/epic-text.mjs +35 -0
- package/assets/task-flow/measure/epic.mjs +114 -0
- package/assets/task-flow/measure/folder.mjs +16 -0
- package/assets/task-flow/measure/footprint.mjs +28 -0
- package/assets/task-flow/measure/grill.mjs +21 -0
- package/assets/task-flow/measure/host.mjs +8 -0
- package/assets/task-flow/measure/owner.mjs +20 -0
- package/assets/task-flow/measure/plan.mjs +27 -0
- package/assets/task-flow/measure/pr.mjs +20 -0
- package/assets/task-flow/measure/progress.mjs +50 -0
- package/assets/task-flow/measure/session.mjs +175 -0
- package/assets/task-flow/measure/task.mjs +23 -0
- package/assets/task-flow/measure/text.mjs +77 -0
- package/assets/task-flow/source/git.mjs +86 -0
- package/assets/task-flow/source/host.mjs +172 -0
- package/assets/task-flow/source/marks.mjs +56 -0
- package/assets/task-flow/source/owner.mjs +74 -0
- package/assets/task-flow/source/records.mjs +116 -0
- package/assets/task-flow/source/session.mjs +232 -0
- package/assets/task-flow/source/steps.mjs +28 -0
- package/assets/task-flow/source/tree.mjs +42 -0
- package/assets/templates/rule.md +2 -2
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +30 -0
- package/bin/agent-kit.js.map +1 -1
- package/lib/agent-checks.d.ts +55 -0
- package/lib/agent-checks.d.ts.map +1 -0
- package/lib/agent-checks.js +209 -0
- package/lib/agent-checks.js.map +1 -0
- package/lib/assets.d.ts.map +1 -1
- package/lib/assets.js +7 -2
- package/lib/assets.js.map +1 -1
- package/lib/cargo-prose.d.ts +2 -1
- package/lib/cargo-prose.d.ts.map +1 -1
- package/lib/cargo-prose.js.map +1 -1
- package/lib/cargo.d.ts +29 -0
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +27 -1
- package/lib/cargo.js.map +1 -1
- package/lib/cascade.d.ts.map +1 -1
- package/lib/cascade.js +3 -1
- package/lib/cascade.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +78 -2
- package/lib/commands.js.map +1 -1
- package/lib/companion.d.ts +0 -5
- package/lib/companion.d.ts.map +1 -1
- package/lib/companion.js +1 -1
- package/lib/companion.js.map +1 -1
- package/lib/config.d.ts +18 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +18 -1
- package/lib/config.js.map +1 -1
- package/lib/cost.d.ts +0 -8
- package/lib/cost.d.ts.map +1 -1
- package/lib/cost.js +4 -4
- package/lib/cost.js.map +1 -1
- package/lib/epic-window-send.d.ts +74 -0
- package/lib/epic-window-send.d.ts.map +1 -0
- package/lib/epic-window-send.js +166 -0
- package/lib/epic-window-send.js.map +1 -0
- package/lib/hooks-map.d.ts +4 -12
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +4 -27
- package/lib/hooks-map.js.map +1 -1
- package/lib/integrity.d.ts +3 -0
- package/lib/integrity.d.ts.map +1 -1
- package/lib/integrity.js +7 -0
- package/lib/integrity.js.map +1 -1
- package/lib/metric-lines.d.ts +2 -1
- package/lib/metric-lines.d.ts.map +1 -1
- package/lib/metric-lines.js +49 -1
- package/lib/metric-lines.js.map +1 -1
- package/lib/metric-send-mark.d.ts +6 -3
- package/lib/metric-send-mark.d.ts.map +1 -1
- package/lib/metric-send-mark.js +15 -5
- package/lib/metric-send-mark.js.map +1 -1
- package/lib/metric-send.d.ts +6 -2
- package/lib/metric-send.d.ts.map +1 -1
- package/lib/metric-send.js +47 -13
- package/lib/metric-send.js.map +1 -1
- package/lib/metrics.d.ts +17 -0
- package/lib/metrics.d.ts.map +1 -1
- package/lib/metrics.js +26 -15
- package/lib/metrics.js.map +1 -1
- package/lib/observations-cargo.d.ts +1 -5
- package/lib/observations-cargo.d.ts.map +1 -1
- package/lib/observations-cargo.js +2 -2
- package/lib/observations-cargo.js.map +1 -1
- package/lib/observations.d.ts +0 -2
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js +3 -3
- package/lib/observations.js.map +1 -1
- package/lib/order.d.ts +0 -2
- package/lib/order.d.ts.map +1 -1
- package/lib/order.js +0 -4
- package/lib/order.js.map +1 -1
- package/lib/outcomes.d.ts +7 -9
- package/lib/outcomes.d.ts.map +1 -1
- package/lib/outcomes.js +8 -7
- package/lib/outcomes.js.map +1 -1
- package/lib/proposals.d.ts +0 -1
- package/lib/proposals.d.ts.map +1 -1
- package/lib/proposals.js +1 -1
- package/lib/proposals.js.map +1 -1
- package/lib/push-gate.d.ts +13 -0
- package/lib/push-gate.d.ts.map +1 -1
- package/lib/push-gate.js +11 -7
- package/lib/push-gate.js.map +1 -1
- package/lib/push-set-usefulness.d.ts +78 -0
- package/lib/push-set-usefulness.d.ts.map +1 -0
- package/lib/push-set-usefulness.js +225 -0
- package/lib/push-set-usefulness.js.map +1 -0
- package/lib/shipment.d.ts +2 -11
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.fixture.d.ts +0 -3
- package/lib/shipment.fixture.d.ts.map +1 -1
- package/lib/shipment.fixture.js +3 -3
- package/lib/shipment.fixture.js.map +1 -1
- package/lib/shipment.js +2 -2
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts +10 -0
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +14 -1
- package/lib/sync.js.map +1 -1
- package/lib/traits.d.ts +0 -3
- package/lib/traits.d.ts.map +1 -1
- package/lib/traits.js +2 -2
- package/lib/traits.js.map +1 -1
- package/lib/variants.d.ts +0 -1
- package/lib/variants.d.ts.map +1 -1
- package/lib/variants.js +1 -1
- package/lib/variants.js.map +1 -1
- package/lib/work-result.d.ts +43 -0
- package/lib/work-result.d.ts.map +1 -0
- package/lib/work-result.js +39 -0
- package/lib/work-result.js.map +1 -0
- package/package.json +1 -1
- package/assets/checks/signals/ui-kit.json +0 -11
- package/assets/hooks/claim-guard.sh +0 -212
- package/assets/hooks/grill-gate-ask.sh +0 -26
- package/assets/hooks/grill-gate-bypass.sh +0 -61
- package/assets/hooks/grill-gate-options.sh +0 -50
- package/assets/hooks/grill-gate.sh +0 -482
- package/assets/hooks/postmortem-guard.sh +0 -124
- package/assets/hooks/proposal-guard.sh +0 -154
- package/assets/hooks/stand-login-guard.sh +0 -107
- package/assets/hooks/turn-exit-epic.sh +0 -173
- package/assets/hooks/turn-exit-patterns.sh +0 -123
- package/assets/hooks/turn-exit-verdict.sh +0 -149
- package/assets/hooks/waiting-turn-guard.sh +0 -320
- package/assets/hooks/work-start-guard.sh +0 -175
package/README.md
CHANGED
|
@@ -27,7 +27,8 @@ npx agent-kit sync # разложить выбранное в docs/constitu
|
|
|
27
27
|
npx agent-kit doctor # что разложено, что отстало, чего не хватает
|
|
28
28
|
npx agent-kit adopt # отдать пакету файлы, лежащие на его путях не от него
|
|
29
29
|
npx agent-kit stats # чем пользовались, чем ни разу, обо что спотыкались
|
|
30
|
-
npx agent-kit metrics # отказы,
|
|
30
|
+
npx agent-kit metrics # отказы, результат работы, «Проверки набора», мёртвые правила; --day 2026-11-13 — за день
|
|
31
|
+
npx agent-kit recount --days 21 # пересчитать прошлые дни по записям разговоров
|
|
31
32
|
npx agent-kit send # отправить числа по дням: проверки и сессии делают это сами
|
|
32
33
|
npx agent-kit cost # сколько весит вход в работу, одно правило и весь слой
|
|
33
34
|
```
|
|
@@ -132,8 +133,8 @@ npx agent-kit init --host gitlab # или спросит, если запу
|
|
|
132
133
|
Закон и правило, которых никто не открывает, не действуют, поэтому пакет везёт и хуки, которые
|
|
133
134
|
их зовут.
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
`skill-loaded.sh` записывает загрузку, `skill-gate-rearm.sh`
|
|
136
|
+
**Проверка правил.** `skill-gate.sh` кладёт правило в сессию и пропускает правку; отказывает, если правило длиннее `RT_GATE_CONTEXT_LIMIT` (10 000 знаков), правила не помещаются вместе или не прочиталось.
|
|
137
|
+
`skill-loaded.sh` записывает загрузку, `skill-gate-rearm.sh` снова включает проверку после сжатия
|
|
137
138
|
контекста, `constitution-index.sh` печатает указатель законов на старте сессии.
|
|
138
139
|
|
|
139
140
|
**Сторожевые хуки.** Главная ветка, поставка, документ в одном коммите с правкой, проверки
|
|
@@ -452,8 +453,7 @@ PR влит, и вливанием в текущую ветку во всех п
|
|
|
452
453
|
умолчание, а не отказ, — проверка, которой в дереве нечего сверять, молчит.
|
|
453
454
|
|
|
454
455
|
Проверки, чей ход зависит от хостинга, лежат видами: `board`, `check-board` и `task-new`
|
|
455
|
-
приезжают в дерево под общими именами, а разговаривают с
|
|
456
|
-
при `init`.
|
|
456
|
+
приезжают в дерево под общими именами, а разговаривают с хостингом, выбранным при `init`.
|
|
457
457
|
|
|
458
458
|
## Раскладка и право на запуск
|
|
459
459
|
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The action of a call: the class the decision table knows a tool call by.
|
|
3
|
+
*
|
|
4
|
+
* A row of the table is keyed by its hook, its action and the facts. A guard that judges one kind of
|
|
5
|
+
* call names its action itself; a guard that judges every edit — the window fill, the handover entry,
|
|
6
|
+
* the exam — sees an edit of code, of a plan or of an override alike, and its rows differ only by the
|
|
7
|
+
* action. If such a guard named one action for all of them, a row of the table could be flipped with
|
|
8
|
+
* no effect on the guard, and the table would describe a decision nobody takes.
|
|
9
|
+
*
|
|
10
|
+
* So the action is computed from the call, here, once: every class the call fits, the most specific
|
|
11
|
+
* first. The decider takes the first one the hook has a row for.
|
|
12
|
+
*
|
|
13
|
+
* Content decides some classes: a template whose button has no anchor, a document with officialese.
|
|
14
|
+
* They are asked of the same analyses the content guards run, not of copies of them.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
17
|
+
import { isAbsolute, join } from 'node:path';
|
|
18
|
+
|
|
19
|
+
import { checkProse } from './check-prose-style.mjs';
|
|
20
|
+
|
|
21
|
+
const SHELL_TOOLS = new Set(['Bash', 'mcp__webstorm__execute_terminal_command']);
|
|
22
|
+
const EDIT_TOOLS = new Set(['Edit', 'Write', 'MultiEdit', 'mcp__webstorm__create_new_file']);
|
|
23
|
+
|
|
24
|
+
/** A shell command that writes into a progress or a plan file. */
|
|
25
|
+
const SHELL_WRITES_FLOW = /(progress|plan)\.md/;
|
|
26
|
+
const SHELL_WRITE = /(>>?|\btee\b|\bsed\s+-i|\bperl\s+-[a-z]*i)/;
|
|
27
|
+
|
|
28
|
+
/** The layout header within the first twelve lines — the sign the source guard reads. */
|
|
29
|
+
const LAYOUT_HEADER = /^\s*(<!--|\/\/|#|\/\*|\*)\s*rt-kit v\S+ · \S+ · [0-9a-f]+/m;
|
|
30
|
+
|
|
31
|
+
function laidOut(path) {
|
|
32
|
+
try {
|
|
33
|
+
return existsSync(path) && LAYOUT_HEADER.test(readFileSync(path, 'utf8').split('\n', 12).join('\n'));
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function proseDirty(text) {
|
|
40
|
+
try {
|
|
41
|
+
return checkProse(text).length > 0;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function shellClasses(c) {
|
|
48
|
+
const out = [];
|
|
49
|
+
const has = (re) => re.test(c);
|
|
50
|
+
if (has(/\bgh\s+run\s+rerun\b/)) out.push('rerun_run');
|
|
51
|
+
if (has(/\bgit\s+(reset\s+--hard|checkout\s+--\s|clean\s+-[a-z]*f|restore\b)/)) out.push('discard');
|
|
52
|
+
if (has(/\bgit\s+add\s+[^;&|]*docs\/tasks\//) && has(/\bgit\s+commit\b/)) out.push('commit_folder');
|
|
53
|
+
if (has(/\bgit\s+commit\b[^;&|]*--amend\b/)) out.push('amend_signature');
|
|
54
|
+
if (has(/\bgit\s+commit\b[^;&|]*--no-verify\b/)) out.push('commit_skip_hooks');
|
|
55
|
+
if (has(/\bgit\s+commit\b/)) out.push('commit');
|
|
56
|
+
if (has(/\bgit\s+push\b[^;&|]*--no-verify\b/)) out.push('push_skip_hooks');
|
|
57
|
+
if (has(/\bgit\s+push\b[^]*&&[^]*\bgit\s+push\b/)) out.push('push_multi');
|
|
58
|
+
if (has(/\bgit\s+(checkout|switch)\s+[^&;|]*&&\s*git\s+push\b/)) out.push('push_switch');
|
|
59
|
+
if (has(/\bcd\s+[^&;|]*&&\s*git\s+push\b/)) out.push('push_second_copy');
|
|
60
|
+
if (has(/\bgit\s+push\b/)) out.push('push');
|
|
61
|
+
const created = c.match(/\bgit\s+(?:checkout\s+-b|switch\s+-c)\s+(\S+)(?:\s+([^\s;&|]+))?/);
|
|
62
|
+
if (created) {
|
|
63
|
+
const [, name, base] = created;
|
|
64
|
+
const task = /^[A-Z]+-\d+-/.test(name);
|
|
65
|
+
if (task && /[A-Z]/.test(name.replace(/^[A-Z]+-\d+-/, ''))) out.push('branch_create_bad_name');
|
|
66
|
+
if (task && !(base ?? '').startsWith('origin/')) out.push('branch_create_stale_base');
|
|
67
|
+
if (!task) out.push('branch_create_local');
|
|
68
|
+
}
|
|
69
|
+
if (has(/\bgit\s+(checkout\s+-b|switch\s+-c|branch\s+[^-])/)) out.push('branch_create');
|
|
70
|
+
if (has(/\bgh\s+pr\s+create\b/)) out.push('pr_create');
|
|
71
|
+
if (has(/\bgh\s+pr\s+ready\b/)) out.push('pr_ready');
|
|
72
|
+
if (has(/\bgh\s+pr\s+merge\b/)) out.push('pr_merge');
|
|
73
|
+
if (has(/\bgh\s+pr\s+edit\b[^;&|]*reviewer/)) out.push('set_reviewer');
|
|
74
|
+
if (has(/\btask:new\b/)) out.push('new_task', 'task_new');
|
|
75
|
+
if (has(/\btask:move\b/)) out.push('task_move');
|
|
76
|
+
if (has(/\bgit\s+merge\b/)) out.push('merge_base');
|
|
77
|
+
if (has(SHELL_WRITES_FLOW) && has(SHELL_WRITE)) out.push('shell_write_progress');
|
|
78
|
+
if (has(/(^|[;&|]\s*)cp\s/)) out.push('copy_template');
|
|
79
|
+
if (has(/\bprisma\s+migrate\s+reset\b/)) out.push('db_reset');
|
|
80
|
+
if (has(/\bprisma\s+migrate\s+(deploy|dev)\b/)) out.push('migrate');
|
|
81
|
+
if (has(/\bcurl\b[^;&|]*\b(localhost|127\.0\.0\.1)\b/)) out.push('check_stand');
|
|
82
|
+
if (has(/\brun\s+serve:|\bnx\s+serve\b|\bng\s+serve\b/)) out.push('raise_dev_server');
|
|
83
|
+
if (has(/\bhttp\.server\b|\bnpx\s+(serve|http-server)\b/)) out.push('raise_static');
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function editClasses(tool, input, cwd) {
|
|
88
|
+
const raw = input.file_path ?? input.pathInProject ?? '';
|
|
89
|
+
const path = raw && !isAbsolute(raw) && cwd ? join(cwd, raw) : raw;
|
|
90
|
+
const added = `${input.new_string ?? ''}${input.content ?? ''}${(input.edits ?? []).map((e) => e.new_string ?? '').join('\n')}`;
|
|
91
|
+
const removed = `${input.old_string ?? ''}${(input.edits ?? []).map((e) => e.old_string ?? '').join('\n')}`;
|
|
92
|
+
const write = tool === 'Write' || tool === 'mcp__webstorm__create_new_file';
|
|
93
|
+
const out = [];
|
|
94
|
+
const at = (re) => re.test(path);
|
|
95
|
+
if (at(/\.git\/rt-kit\/steps\//)) out.push('write_marks');
|
|
96
|
+
if (at(/\/\.claude\/handoff\//)) out.push('write_handover');
|
|
97
|
+
if (at(/\/docs\/tasks\/[^/]+\/progress\.md$/)) {
|
|
98
|
+
if (/- \[x\]/.test(added) || /- \[x\]/.test(removed)) out.push('mark_step_done');
|
|
99
|
+
if (/`[а-яё]+(-[а-яё]+)+`/.test(added + removed)) out.push('set_state');
|
|
100
|
+
out.push('edit_progress');
|
|
101
|
+
}
|
|
102
|
+
if (at(/\/docs\/tasks\/[^/]+\/plan\.md$/)) out.push('edit_plan');
|
|
103
|
+
if (at(/\/docs\/plans\/[^/]+\.md$/)) out.push(/отложено/.test(added + removed) ? 'defer_task' : 'edit_plan');
|
|
104
|
+
if (at(/\/assets\/task-flow\/|\/flow-[a-z-]+\.mjs$|\/task-flow-script\.mjs$/)) out.push('edit_flow_description');
|
|
105
|
+
if (at(/\/\.claude\/rt-kit\/observations\//)) out.push('edit_observations');
|
|
106
|
+
if (at(/\/\.claude\/rt-kit\.json$/)) out.push('edit_rtkit_send');
|
|
107
|
+
if (at(/\/\.claude\/rt-kit\/overrides\//)) out.push(...(write ? ['write_override', 'edit_override'] : ['edit_override']));
|
|
108
|
+
if (write && at(/\/docs\/specs\/.+\/proposed\//)) out.push('write_agreement');
|
|
109
|
+
if (at(/\/projects\/[^/]+\/(src|assets)\/(laws|rules|patterns)\//)) out.push('edit_source');
|
|
110
|
+
if (laidOut(path)) out.push('edit_laid_out');
|
|
111
|
+
if (at(/\.html$/)) {
|
|
112
|
+
if (/<(button|a)\b(?![^>]*qa-dataid)[^>]*>/.test(added)) out.push('template_no_anchor');
|
|
113
|
+
if (/<(input|select|textarea)\b/.test(added)) out.push('template_own_primitive');
|
|
114
|
+
out.push('edit_template');
|
|
115
|
+
}
|
|
116
|
+
if (at(/\.md$/)) {
|
|
117
|
+
if (proseDirty(added)) out.push('write_dirty_md');
|
|
118
|
+
out.push('edit_doc');
|
|
119
|
+
}
|
|
120
|
+
if (at(/\.(ts|js|mjs|cjs|tsx|jsx|scss|css|json|sh)$/)) out.push('edit_code');
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Every class the call fits, the most specific first, and `work_call` last: any call of work. The
|
|
126
|
+
* input is the hook input as the host gives it.
|
|
127
|
+
*/
|
|
128
|
+
export function actionsOf(hookInput) {
|
|
129
|
+
const tool = hookInput?.tool_name ?? '';
|
|
130
|
+
const input = hookInput?.tool_input ?? {};
|
|
131
|
+
const out = [];
|
|
132
|
+
if ((hookInput?.hook_event_name ?? '') === 'Stop' || (hookInput?.hook_event_name ?? '') === 'SubagentStop') return ['end_turn'];
|
|
133
|
+
if (tool === 'EndConversation') out.push('end_conversation');
|
|
134
|
+
if (tool === 'Agent' && input.subagent_type === 'strict-teacher') out.push('call_teacher');
|
|
135
|
+
if (tool === 'mcp__claude-in-chrome__select_browser') out.push('select_pinned', 'select_other');
|
|
136
|
+
if (tool === 'mcp__claude-in-chrome__list_connected_browsers') out.push('list_browsers');
|
|
137
|
+
if (tool.startsWith('mcp__claude-in-chrome__')) out.push('browser_call');
|
|
138
|
+
if (/^mcp__(playwright|puppeteer|chrome-devtools|Claude_Browser)__/.test(tool)) out.push('other_driver');
|
|
139
|
+
if (tool === 'mcp__webstorm__execute_run_configuration') out.push(/package\.json$/.test(input.filePath ?? '') ? 'run_manifest_script' : 'run_config_serve');
|
|
140
|
+
if (SHELL_TOOLS.has(tool)) out.push(...shellClasses(String(input.command ?? '')));
|
|
141
|
+
if (EDIT_TOOLS.has(tool)) out.push(...editClasses(tool, input, hookInput?.cwd ?? ''));
|
|
142
|
+
out.push('work_call');
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Every class of the call the hook has a row for, the most specific first. */
|
|
147
|
+
export function knownActionsOf(hookInput, known) {
|
|
148
|
+
return actionsOf(hookInput).filter((a) => known.has(a));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** The first class of the call the hook has a row for, or null. */
|
|
152
|
+
export function actionOf(hookInput, known) {
|
|
153
|
+
return actionsOf(hookInput).find((a) => known.has(a)) ?? null;
|
|
154
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The state of an open request read by its tip: a run pushed out of the queue, a missing run, a
|
|
3
|
-
* finished piece of work left as a draft, a conflict. Lives in a file of its
|
|
4
|
-
* the work queue stands at the length limit even without it, and these
|
|
3
|
+
* finished piece of work left as a draft, a missing reviewer, a conflict. Lives in a file of its
|
|
4
|
+
* own — the audit of the work queue stands at the length limit even without it, and these five checks are read
|
|
5
5
|
* together and apart from the rest.
|
|
6
6
|
*
|
|
7
7
|
* The line printer and the name of the main branch come as arguments: the module knows the
|
|
8
8
|
* hosting, not the settings of the tree that called it.
|
|
9
9
|
*/
|
|
10
|
+
import { OfflineError, OWNER, REPO, ghJson } from './board.mjs';
|
|
10
11
|
import { onlyIgnoredPaths } from './board-paths.mjs';
|
|
11
12
|
import { evictedOnHead, headCommittedAt, runsOnHead, verdictOnHead } from './board-runs.mjs';
|
|
12
13
|
|
|
@@ -54,6 +55,17 @@ export function checkHeadRun(pull, report, mainBranch, options) {
|
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
// A PR whose base is not the main branch gets no run at all: the workflow listens for PRs
|
|
59
|
+
// into the main branch and does not see events with another base. That is the order of
|
|
60
|
+
// handing in, not a discrepancy — every task of an epic is handed in exactly so — and the
|
|
61
|
+
// audit says nothing about it. The former line was wrong three times over: the event was not
|
|
62
|
+
// lost, reopening will not bring it back, and the base of a task request stays the epic
|
|
63
|
+
// branch to the merge. It is asked before the conflict: a conflicting task PR is named by the
|
|
64
|
+
// conflict line, and «no run while it conflicts» would promise a run that never comes.
|
|
65
|
+
if (pull.baseRefName && pull.baseRefName !== mainBranch) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
57
69
|
if (pull.mergeable === 'CONFLICTING') {
|
|
58
70
|
report(
|
|
59
71
|
`PR #${pull.number}: there is no run on the tip ${pull.headRefOid.slice(0, 8)} and there will be none while it conflicts — ` +
|
|
@@ -64,16 +76,6 @@ export function checkHeadRun(pull, report, mainBranch, options) {
|
|
|
64
76
|
return;
|
|
65
77
|
}
|
|
66
78
|
|
|
67
|
-
// A PR whose base is not the main branch gets no run at all: the workflow listens for PRs
|
|
68
|
-
// into the main branch and does not see events with another base. That is the order of
|
|
69
|
-
// handing in, not a discrepancy — every task of an epic is handed in exactly so — and the
|
|
70
|
-
// audit says nothing about it. The former line was wrong three times over: the event was not
|
|
71
|
-
// lost, reopening will not bring it back, and the base of a task request stays the epic
|
|
72
|
-
// branch to the merge.
|
|
73
|
-
if (pull.baseRefName && pull.baseRefName !== mainBranch) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
79
|
report(
|
|
78
80
|
`PR #${pull.number}: there is no run on the tip ${pull.headRefOid.slice(0, 8)}, and it has lain there ${minutes} min — ` +
|
|
79
81
|
`the pipeline received no event; bring it back by a new commit or by reopening the PR ` +
|
|
@@ -138,6 +140,71 @@ function checkReadyDraft(pull, report, options) {
|
|
|
138
140
|
);
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Who was asked to review a PR and who left a review, each with the kind of the account.
|
|
145
|
+
*
|
|
146
|
+
* Read by REST, a call per list. The same lists asked through the list of PRs need the scope
|
|
147
|
+
* `read:org`, and a token of a machine account that lacks it gets the whole query refused: the
|
|
148
|
+
* audit then printed one line of an error and no line of its own.
|
|
149
|
+
*
|
|
150
|
+
* FAIL-OPEN: no answer — `null`, and the PR is not judged. Without network the refusal is thrown,
|
|
151
|
+
* as everywhere.
|
|
152
|
+
*/
|
|
153
|
+
export function fetchReviewers(number, options) {
|
|
154
|
+
if (!OWNER || !REPO) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
const path = `repos/${OWNER}/${REPO}/pulls/${number}`;
|
|
158
|
+
try {
|
|
159
|
+
return {
|
|
160
|
+
asked: ghJson(
|
|
161
|
+
['api', `${path}/requested_reviewers`, '--jq', '[.users[] | {login, type}] + [.teams[] | {login: .slug, type: "Team"}]'],
|
|
162
|
+
options
|
|
163
|
+
),
|
|
164
|
+
left: ghJson(['api', `${path}/reviews`, '--jq', '[.[] | {login: .user.login, type: .user.type}]'], options),
|
|
165
|
+
};
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (error instanceof OfflineError) {
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A PR nobody was asked to review.
|
|
176
|
+
*
|
|
177
|
+
* Such a PR reaches no inbox: the queue stands while it looks as if it works. A request to review
|
|
178
|
+
* oneself does not count — the host accepts it and creates nothing — so the author is taken out of
|
|
179
|
+
* both lists. A PR opened by a person shows here too: an author cannot be asked, and nobody else
|
|
180
|
+
* was.
|
|
181
|
+
*
|
|
182
|
+
* The lists come apart from the PR, by REST: `reviewers` is `{asked, left}`, each entry a login
|
|
183
|
+
* with the kind of its account.
|
|
184
|
+
*
|
|
185
|
+
* FAIL-OPEN: no lists — the PR is not judged. Silence about the reviewers is not the same as their
|
|
186
|
+
* absence, and a line on it would go red on every PR of a host that hides them.
|
|
187
|
+
*/
|
|
188
|
+
export function checkReviewer(pull, report, reviewers) {
|
|
189
|
+
if (!reviewers) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const author = pull.author?.login ?? null;
|
|
194
|
+
// A bot asked for a review or one that left it is not a person: the PR still reaches no inbox.
|
|
195
|
+
const person = (entry) =>
|
|
196
|
+
Boolean(entry?.login) && entry.type !== 'Bot' && !entry.login.endsWith('[bot]') && entry.login !== author;
|
|
197
|
+
if ([...(reviewers.asked ?? []), ...(reviewers.left ?? [])].some(person)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
report(
|
|
202
|
+
`PR #${pull.number}: the PR has no reviewer — nobody but its author was asked or left a review, and it reaches no inbox; ` +
|
|
203
|
+
`request one by a REST call: gh api -X POST repos/<owner>/<repo>/pulls/${pull.number}/requested_reviewers -f 'reviewers[]=<login>'; ` +
|
|
204
|
+
`a PR opened by the reviewer's own account cannot ask them — close it and open it again as the machine account`
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
141
208
|
/**
|
|
142
209
|
* A PR that conflicts with the main branch.
|
|
143
210
|
*
|
|
@@ -156,8 +223,10 @@ export function checkConflicting(pull, report) {
|
|
|
156
223
|
return;
|
|
157
224
|
}
|
|
158
225
|
|
|
226
|
+
// The host counts mergeability against the base of the PR: for a task that is the epic branch.
|
|
227
|
+
const base = pull.baseRefName ? `«${pull.baseRefName}»` : 'branch';
|
|
159
228
|
report(
|
|
160
|
-
`PR #${pull.number}: it conflicts with
|
|
229
|
+
`PR #${pull.number}: it conflicts with its base ${base} — merge the base into the PR branch, resolve the conflict and push; ` +
|
|
161
230
|
`the owner cannot merge this request, and on the page that shows only inside it`
|
|
162
231
|
);
|
|
163
232
|
}
|
|
@@ -45,6 +45,8 @@ export function runsOnHead(sha, options) {
|
|
|
45
45
|
* neighbouring check of the last rollout.
|
|
46
46
|
*
|
|
47
47
|
* Returns `null` if there were no rollouts at all: that is not a discrepancy but nothing to compare.
|
|
48
|
+
* A comparison the host refused returns the rollout with `behind: null` and the words of the host in
|
|
49
|
+
* `refused`: the caller prints a note and goes on to the lines after it.
|
|
48
50
|
*/
|
|
49
51
|
export function deployLag(workflow, mainBranch, options) {
|
|
50
52
|
const runs = gh(
|
|
@@ -63,11 +65,44 @@ export function deployLag(workflow, mainBranch, options) {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
const run = JSON.parse(last);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
try {
|
|
69
|
+
return { sha: run.sha, at: run.at, behind: commitsBehind(run.sha, mainBranch, options) };
|
|
70
|
+
} catch (error) {
|
|
71
|
+
const words = String(error.stderr ?? error.message ?? '').trim();
|
|
72
|
+
if (!(error instanceof Error) || !COMPARISON_REFUSED.test(words)) {
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
return { sha: run.sha, at: run.at, behind: null, refused: words.split('\n')[0] };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The refusal of the host to compare: it could not build the answer in time. The GraphQL comparison
|
|
81
|
+
* says so by «This may be the result of a timeout», which the reader of the host takes for a network
|
|
82
|
+
* failure by its word «timeout». The words «Something went wrong while executing your query» alone
|
|
83
|
+
* are not enough: the host says them for a commit that is gone as well, measured on 21.11, and such a
|
|
84
|
+
* commit must break the audit, not leave it green. Only the timeout is a note. Another failure — a
|
|
85
|
+
* 422, a 500, a refusal by rights (HTTP 403), a commit that is gone — breaks the audit.
|
|
86
|
+
*/
|
|
87
|
+
const COMPARISON_REFUSED = /result of a timeout/i;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* How many commits the main branch holds past the rolled-out one.
|
|
91
|
+
*
|
|
92
|
+
* Asked by the GraphQL comparison, which counts commits and builds no diff. The REST comparison
|
|
93
|
+
* builds the diff of the whole even for a page of one commit — 300 files on 21.11 — and at a lag of
|
|
94
|
+
* hundreds of commits the host refused it with 422 twice in a row before the PR of a task.
|
|
95
|
+
*/
|
|
96
|
+
function commitsBehind(sha, mainBranch, options) {
|
|
97
|
+
const query =
|
|
98
|
+
`query{repository(owner:"${OWNER}",name:"${REPO}"){` +
|
|
99
|
+
`ref(qualifiedName:"refs/heads/${mainBranch}"){compare(headRef:"${sha}"){behindBy}}}}`;
|
|
100
|
+
const answer = gh(['api', 'graphql', '-f', `query=${query}`, '--jq', '.data.repository.ref.compare.behindBy'], options);
|
|
101
|
+
const behind = Number(String(answer).trim());
|
|
102
|
+
if (String(answer).trim() === '' || !Number.isFinite(behind)) {
|
|
103
|
+
throw new Error(`the comparison of «${mainBranch}» with ${sha.slice(0, 8)} returned no number: ${String(answer).trim() || 'empty'}`);
|
|
104
|
+
}
|
|
105
|
+
return behind;
|
|
71
106
|
}
|
|
72
107
|
|
|
73
108
|
/**
|
|
@@ -262,7 +262,7 @@ export function behindMain(branch, mainBranch, options) {
|
|
|
262
262
|
* and asking for it later would mean a second call per PR. */
|
|
263
263
|
export function fetchOpenPulls(options) {
|
|
264
264
|
return ghJson(
|
|
265
|
-
['pr', 'list', '--state', 'open', '--limit', '200', '--json', 'number,title,headRefName,headRefOid,isDraft,body,mergeable,baseRefName'],
|
|
265
|
+
['pr', 'list', '--state', 'open', '--limit', '200', '--json', 'number,title,headRefName,headRefOid,isDraft,body,mergeable,baseRefName,author'],
|
|
266
266
|
options
|
|
267
267
|
);
|
|
268
268
|
}
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
taskDirs,
|
|
50
50
|
} from './board.mjs';
|
|
51
51
|
import { checkBranchFolders, checkUntrackedFolders } from './board-folders.mjs';
|
|
52
|
-
import { checkConflicting, checkHeadRun } from './board-pull-state.mjs';
|
|
52
|
+
import { checkConflicting, checkHeadRun, checkReviewer, fetchReviewers } from './board-pull-state.mjs';
|
|
53
53
|
import { checkLongWork } from './board-long-work.mjs';
|
|
54
54
|
import { HAS_PIPELINE, deployLag, lastDeploy, lastMainRun, pipelineText, pipelineWakesOnPush } from './board-runs.mjs';
|
|
55
55
|
import { checkEpicLinks, checkEpicPullBase, checkEpicState, checkEpicSubIssues } from './board-epics.mjs';
|
|
@@ -162,7 +162,7 @@ function folderInBranch(branch, options) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
let checked = { issues: 0, pulls: 0, cargo: 0, offBase: 0 };
|
|
165
|
+
let checked = { issues: 0, pulls: 0, cargo: 0, offBase: 0, lagging: [] };
|
|
166
166
|
|
|
167
167
|
// Drafts are judged by the disk and so are checked always: no connection is needed for that.
|
|
168
168
|
checkDrafts();
|
|
@@ -181,7 +181,7 @@ try {
|
|
|
181
181
|
// such a record, whatever labels it wears.
|
|
182
182
|
const open = CARGO_LABELS.size === 0 ? allOpen : allOpen.filter((issue) => !isCargo(issue));
|
|
183
183
|
const pulls = fetchOpenPulls(options);
|
|
184
|
-
checked = { issues: issues.length, pulls: pulls.length, cargo: allOpen.length - open.length, offBase: 0 };
|
|
184
|
+
checked = { issues: issues.length, pulls: pulls.length, cargo: allOpen.length - open.length, offBase: 0, lagging: [] };
|
|
185
185
|
|
|
186
186
|
for (const item of board.foreign) {
|
|
187
187
|
report(`the board: ${item} — the board holds tasks, not PRs about them`);
|
|
@@ -241,16 +241,16 @@ try {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
checkConflicting(pull, report);
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
|
|
244
|
+
checkReviewer(pull, report, fetchReviewers(pull.number, options));
|
|
245
|
+
|
|
246
|
+
// The PR falling behind its base is counted, not refused: a lag without a conflict the host
|
|
247
|
+
// merges itself, and a line that told to merge the base in sent the executor to do what the
|
|
248
|
+
// rules forbid. A conflicting PR is named by its own line above. The base of a task is the
|
|
249
|
+
// epic branch, and its lag behind main is the epic's, not the task's.
|
|
250
|
+
const base = pull.baseRefName || MAIN_BRANCH;
|
|
251
|
+
const behind = pull.mergeable === 'CONFLICTING' ? 0 : behindMain(pull.headRefName, base, options);
|
|
249
252
|
if (behind > 0) {
|
|
250
|
-
|
|
251
|
-
`PR #${pull.number}: the branch lags «${MAIN_BRANCH}» by ${behind} commits — the run went from a base ` +
|
|
252
|
-
`the main branch no longer carries. Merge the main branch in, revise the check set by what the branch carries now, and run again`
|
|
253
|
-
);
|
|
253
|
+
checked.lagging.push(`PR #${pull.number} lags «${base}» by ${behind} commits`);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
if (!FOLDER_SKIP.test(String(pull.body ?? '')) && pull.headRefName) {
|
|
@@ -316,21 +316,32 @@ try {
|
|
|
316
316
|
// Production is audited against the main branch by the last successful rollout. A task leaves the
|
|
317
317
|
// queue by a merge, but a merge is not yet production: where the rollout is started by hand, any
|
|
318
318
|
// number of commits may lie between them, and there is nowhere to notice this from.
|
|
319
|
+
let productionOffline = false;
|
|
320
|
+
let hostFailed = false;
|
|
319
321
|
if (!offline && DEPLOY_WORKFLOW) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
+
const token = botToken() ?? undefined;
|
|
323
|
+
productionStep(() => {
|
|
322
324
|
const lag = deployLag(DEPLOY_WORKFLOW, MAIN_BRANCH, { token });
|
|
323
325
|
if (lag === null) {
|
|
324
326
|
report(`there was not a single rollout by «${DEPLOY_WORKFLOW}» — there is nothing to compare production against`);
|
|
327
|
+
} else if (lag.refused) {
|
|
328
|
+
// The host could not compare: a note, not a divergence — nothing was judged.
|
|
329
|
+
console.log(
|
|
330
|
+
`check-board: production was not compared with «${MAIN_BRANCH}» — the last rollout is ` +
|
|
331
|
+
`${lag.sha.slice(0, 8)} of ${String(lag.at).slice(0, 10)}, the host answered: ${lag.refused}`
|
|
332
|
+
);
|
|
325
333
|
} else if (lag.behind > 0) {
|
|
326
334
|
report(
|
|
327
335
|
`production lags «${MAIN_BRANCH}» by ${lag.behind} commits: the last rollout is ${lag.sha.slice(0, 8)} of ${String(lag.at).slice(0, 10)}`
|
|
328
336
|
);
|
|
329
337
|
}
|
|
338
|
+
});
|
|
330
339
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
340
|
+
// Why production fell behind, the lag does not say: it is counted by the last SUCCESSFUL
|
|
341
|
+
// rollout, and "not started" and "failed" look the same through it. They lead to different
|
|
342
|
+
// things — the first is started, the second is read by its output and fixed. It is asked in a
|
|
343
|
+
// step of its own: a lag the host could not measure does not hide a rollout that fell.
|
|
344
|
+
productionStep(() => {
|
|
334
345
|
const deploy = lastDeploy(DEPLOY_WORKFLOW, { token });
|
|
335
346
|
if (deploy.verdict === 'failure') {
|
|
336
347
|
report(
|
|
@@ -338,12 +349,28 @@ if (!offline && DEPLOY_WORKFLOW) {
|
|
|
338
349
|
`the main branch is ahead of production, and merges on top will travel the same way — ${deploy.url}`
|
|
339
350
|
);
|
|
340
351
|
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* One request about production. No connection is a note, said once: the next step would only
|
|
357
|
+
* repeat it. Any other failure is a line of its own and the exit code 1, not a stack — and the audit
|
|
358
|
+
* goes on: what the queue and the next steps have judged is printed, not thrown away with it.
|
|
359
|
+
*/
|
|
360
|
+
function productionStep(step) {
|
|
361
|
+
if (productionOffline) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
try {
|
|
365
|
+
step();
|
|
341
366
|
} catch (error) {
|
|
342
367
|
if (error instanceof OfflineError) {
|
|
343
368
|
console.log(`check-board: production was not checked — ${error.message}`);
|
|
344
|
-
|
|
345
|
-
|
|
369
|
+
productionOffline = true;
|
|
370
|
+
return;
|
|
346
371
|
}
|
|
372
|
+
console.error(`check-board: production was not checked, the host failed — ${String(error.message ?? error)}`);
|
|
373
|
+
hostFailed = true;
|
|
347
374
|
}
|
|
348
375
|
}
|
|
349
376
|
|
|
@@ -394,6 +421,14 @@ if (!offline && checked.offBase > 0) {
|
|
|
394
421
|
);
|
|
395
422
|
}
|
|
396
423
|
|
|
424
|
+
// A lag is a count, not a discrepancy: the line changes no exit code and asks for no merge.
|
|
425
|
+
if (!offline && checked.lagging.length > 0) {
|
|
426
|
+
console.log(
|
|
427
|
+
`check-board: open PRs behind their base without a conflict — ${checked.lagging.join('; ')}: ` +
|
|
428
|
+
`nothing to do, the host merges such a branch itself; ask the host again before the merge`
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
|
|
397
432
|
// What was filtered out is named by number: silent filtering is indistinguishable from a broken
|
|
398
433
|
// audit — a label named with a typo would switch the check off entirely and say nothing about it.
|
|
399
434
|
if (!offline && checked.cargo > 0) {
|
|
@@ -412,6 +447,10 @@ if (problems.length > 0) {
|
|
|
412
447
|
process.exit(1);
|
|
413
448
|
}
|
|
414
449
|
|
|
450
|
+
if (hostFailed) {
|
|
451
|
+
process.exit(1);
|
|
452
|
+
}
|
|
453
|
+
|
|
415
454
|
if (offline) {
|
|
416
455
|
process.exit(0);
|
|
417
456
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* decision, and four discount mechanics that were never started would have found no binding
|
|
17
17
|
* at all. The key of the link is the text of the rule itself, so it cannot be reworded while
|
|
18
18
|
* the binding is left unfixed. A rule without a binding is an intention, and it is written as
|
|
19
|
-
* an open question
|
|
19
|
+
* an open question: `Q-<law letters>-<number>` in a law, `Q-<number>` in a spec.
|
|
20
20
|
*
|
|
21
21
|
* 2. THE CONTRACT AGAINST THE DECORATORS. The table of procedures is audited against what is
|
|
22
22
|
* declared in the domain's `*.procedure.ts`: `@RequiresPermission` / `@PublicProcedure` and
|
|
@@ -410,7 +410,7 @@ for (const scenario of byId.values()) {
|
|
|
410
410
|
report(
|
|
411
411
|
`${scenario.file}:${scenario.line}`,
|
|
412
412
|
`${scenario.id} promises what a person sees, and ${off ? 'the end-to-end test for it is switched off by an environment variable' : 'only a unit test checks it'} ` +
|
|
413
|
-
`(${places[0].place}) — either the test goes the path of the user, or the scenario needs the mark
|
|
413
|
+
`(${places[0].place}) — either the test goes the path of the user, or the scenario needs the mark «Coverage: partial»`
|
|
414
414
|
);
|
|
415
415
|
continue;
|
|
416
416
|
}
|
|
@@ -101,21 +101,33 @@ function sectionsOf(pattern) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const sections = [];
|
|
104
|
+
|
|
105
|
+
// A pattern split into a hot index and a cold part keeps every state heading hot, while the body
|
|
106
|
+
// of a section, its move line included, may stand in the cold part under the same heading. The
|
|
107
|
+
// cold part adds moves to the sections of the index and declares none of its own; its second file
|
|
108
|
+
// continues the section the first one broke off in.
|
|
109
|
+
const cold = ['pitfalls.md', 'pitfalls-2.md'].map((name) => join(SKILLS, pattern, name)).filter((path) => existsSync(path));
|
|
110
|
+
|
|
104
111
|
let current = null;
|
|
105
112
|
|
|
106
|
-
for (const
|
|
107
|
-
|
|
113
|
+
for (const path of [file, ...cold]) {
|
|
114
|
+
if (!path.endsWith('pitfalls-2.md')) current = null;
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
for (const line of readFileSync(path, 'utf8').split('\n')) {
|
|
117
|
+
const heading = line.match(/^#+\s+(?:State|Состояние)\s+`([^`]+)`/);
|
|
118
|
+
|
|
119
|
+
if (heading) {
|
|
120
|
+
const text = line.replace(/^#+\s+/, '');
|
|
121
|
+
current = path === file ? { name: heading[1], heading: text, moves: [] } : (sections.find((one) => one.heading === text) ?? null);
|
|
122
|
+
if (path === file) sections.push(current);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
114
125
|
|
|
115
|
-
|
|
126
|
+
const marker = current ? markerOf(line) : undefined;
|
|
116
127
|
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
if (marker) {
|
|
129
|
+
current.moves.push(line.slice(marker.length).trim());
|
|
130
|
+
}
|
|
119
131
|
}
|
|
120
132
|
}
|
|
121
133
|
|