@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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// The task flow as an executable scenario: the data language of `flow-syntax.mjs`, nothing here runs.
|
|
2
|
+
// A state is left when its exit is measured; the first state whose exit is unmet is where the work
|
|
3
|
+
// stands. A release case says when a turn may end before the scenario does. A new fact is a new
|
|
4
|
+
// measurer in `measure/`; a new combination of facts is a line here.
|
|
5
|
+
({
|
|
6
|
+
source: {
|
|
7
|
+
git: { open: {} },
|
|
8
|
+
tree: { open: {} },
|
|
9
|
+
host: { open: {} },
|
|
10
|
+
marks: { open: {} },
|
|
11
|
+
owner: { open: {} },
|
|
12
|
+
session: { open: {} },
|
|
13
|
+
steps: { open: {} },
|
|
14
|
+
records: { open: {} },
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
measure: {
|
|
18
|
+
grill: { written: { git: source.git, tree: source.tree } },
|
|
19
|
+
epic: {
|
|
20
|
+
declared: { git: source.git, host: source.host, tree: source.tree },
|
|
21
|
+
nextTaken: { git: source.git, host: source.host, tree: source.tree },
|
|
22
|
+
mergedMarked: { git: source.git, host: source.host, tree: source.tree },
|
|
23
|
+
finished: { git: source.git, host: source.host, tree: source.tree },
|
|
24
|
+
},
|
|
25
|
+
agreement: { named: { git: source.git, tree: source.tree } },
|
|
26
|
+
task: { taken: { git: source.git, host: source.host } },
|
|
27
|
+
plan: { approved: { git: source.git, marks: source.marks, steps: source.steps, records: source.records } },
|
|
28
|
+
progress: {
|
|
29
|
+
mirrors: { git: source.git, steps: source.steps },
|
|
30
|
+
done: { git: source.git, tree: source.tree, marks: source.marks, steps: source.steps },
|
|
31
|
+
},
|
|
32
|
+
footprint: { touched: { git: source.git } },
|
|
33
|
+
folder: { archived: { git: source.git } },
|
|
34
|
+
pr: { handed: { git: source.git, host: source.host } },
|
|
35
|
+
copy: {
|
|
36
|
+
outsideEpic: { git: source.git, host: source.host, tree: source.tree },
|
|
37
|
+
outOfScenario: { git: source.git, host: source.host, tree: source.tree },
|
|
38
|
+
},
|
|
39
|
+
owner: { saidStop: { owner: source.owner }, nudged: { owner: source.owner } },
|
|
40
|
+
session: {
|
|
41
|
+
wrote: { session: source.session },
|
|
42
|
+
role: { session: source.session },
|
|
43
|
+
menuLost: { session: source.session },
|
|
44
|
+
forbidden: { session: source.session },
|
|
45
|
+
idle: { session: source.session },
|
|
46
|
+
unread: { session: source.session },
|
|
47
|
+
waiting: { session: source.session },
|
|
48
|
+
},
|
|
49
|
+
host: { silent: { host: source.host } },
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
state: {
|
|
53
|
+
request: {
|
|
54
|
+
title: 'просьба-не-разобрана',
|
|
55
|
+
action: 'explore the tree, then ask the questions',
|
|
56
|
+
pattern: 'task-flow-start',
|
|
57
|
+
exit: measure.grill.written,
|
|
58
|
+
},
|
|
59
|
+
epic: {
|
|
60
|
+
title: 'эпик-заведён',
|
|
61
|
+
action: 'take the epic branch from the main branch; the epic card moves with the first task',
|
|
62
|
+
pattern: 'epic-flow-declare',
|
|
63
|
+
exit: measure.epic.declared,
|
|
64
|
+
},
|
|
65
|
+
grill: {
|
|
66
|
+
title: 'разбор-закрыт',
|
|
67
|
+
action: 'write the product agreement, or the reason there is none',
|
|
68
|
+
pattern: 'task-flow-start',
|
|
69
|
+
exit: measure.agreement.named,
|
|
70
|
+
},
|
|
71
|
+
agreement: {
|
|
72
|
+
title: 'договорённость-записана',
|
|
73
|
+
action: 'create the task, the branch from the epic branch, and the folder',
|
|
74
|
+
pattern: 'task-flow-start',
|
|
75
|
+
exit: measure.task.taken,
|
|
76
|
+
},
|
|
77
|
+
taken: {
|
|
78
|
+
title: 'задача-взята',
|
|
79
|
+
action: 'write the plan',
|
|
80
|
+
pattern: 'task-flow-start',
|
|
81
|
+
exit: measure.plan.approved,
|
|
82
|
+
},
|
|
83
|
+
planned: {
|
|
84
|
+
title: 'замысел-записан',
|
|
85
|
+
action: 'do the first stage',
|
|
86
|
+
pattern: 'task-flow-start',
|
|
87
|
+
exit: measure.progress.mirrors,
|
|
88
|
+
},
|
|
89
|
+
stage: {
|
|
90
|
+
title: 'этап-идёт',
|
|
91
|
+
action: 'finish the stage: `step N.M` measures each step and marks it done',
|
|
92
|
+
pattern: 'task-flow-resume',
|
|
93
|
+
exit: measure.progress.done,
|
|
94
|
+
},
|
|
95
|
+
stagesOver: {
|
|
96
|
+
title: 'этапы-кончились',
|
|
97
|
+
action: 'merge the agreement, bring the texts up to date, run the suite',
|
|
98
|
+
pattern: 'task-flow-close',
|
|
99
|
+
exit: measure.footprint.touched,
|
|
100
|
+
},
|
|
101
|
+
reviewOver: {
|
|
102
|
+
title: 'разбор-кончился',
|
|
103
|
+
action: 'take the folder apart by the last commit',
|
|
104
|
+
pattern: 'task-flow-archive',
|
|
105
|
+
exit: measure.folder.archived,
|
|
106
|
+
},
|
|
107
|
+
folderGone: {
|
|
108
|
+
title: 'папка-разобрана',
|
|
109
|
+
action: 'the work queue audit, then open the PR',
|
|
110
|
+
pattern: 'task-flow-close',
|
|
111
|
+
exit: measure.pr.handed,
|
|
112
|
+
},
|
|
113
|
+
handed: {
|
|
114
|
+
title: 'работа-отдана',
|
|
115
|
+
action: 'send the rules review to the background, then take the next task of the epic',
|
|
116
|
+
pattern: 'task-flow-archive',
|
|
117
|
+
exit: measure.epic.nextTaken,
|
|
118
|
+
},
|
|
119
|
+
merged: {
|
|
120
|
+
title: 'влито',
|
|
121
|
+
action: 'merge the PRs of the chain bottom-up, mark the merged tasks by the branch of the next one',
|
|
122
|
+
pattern: 'task-flow-resume',
|
|
123
|
+
exit: measure.epic.mergedMarked,
|
|
124
|
+
},
|
|
125
|
+
epicOver: {
|
|
126
|
+
title: 'задачи-эпика-кончились',
|
|
127
|
+
action: 'open the PR of the epic into the main branch',
|
|
128
|
+
pattern: 'task-flow-close',
|
|
129
|
+
exit: measure.epic.finished,
|
|
130
|
+
end: true,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
release: {
|
|
135
|
+
scenarioEnd: {
|
|
136
|
+
when: { any: [measure.epic.finished, { all: [measure.copy.outsideEpic, measure.pr.handed] }] },
|
|
137
|
+
order: 1,
|
|
138
|
+
log: 'the end of the scenario',
|
|
139
|
+
},
|
|
140
|
+
stopWord: { when: measure.owner.saidStop, order: 2, log: 'a stop word of the owner' },
|
|
141
|
+
// The state «работа-отдана» sends work to the background by its own action and goes on: there
|
|
142
|
+
// the wait releases nothing.
|
|
143
|
+
background: {
|
|
144
|
+
when: { all: [measure.session.waiting, { not: measure.pr.handed }] },
|
|
145
|
+
order: 3,
|
|
146
|
+
log: 'a background task of the session runs',
|
|
147
|
+
},
|
|
148
|
+
noWrite: {
|
|
149
|
+
when: {
|
|
150
|
+
any: [
|
|
151
|
+
measure.copy.outOfScenario,
|
|
152
|
+
{ all: [{ not: measure.session.wrote }, { not: measure.owner.nudged }] },
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
order: 4,
|
|
156
|
+
log: 'no write to the tree, or a branch outside the scenario',
|
|
157
|
+
},
|
|
158
|
+
role: { when: measure.session.role, order: 5, log: 'a role session' },
|
|
159
|
+
hostSilent: { when: measure.host.silent, order: 6, log: 'the host did not answer twice' },
|
|
160
|
+
menuLost: { when: measure.session.menuLost, order: 8, log: 'the menu did not reach the owner' },
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
words: {
|
|
164
|
+
stop: [
|
|
165
|
+
'стоп', 'стой', 'хватит', 'остановись', 'прекрати', 'не сейчас', 'подожди', 'погоди', 'жди',
|
|
166
|
+
'пауза', 'отбой', 'на сегодня всё', 'stop', 'wait', 'not now', 'pause',
|
|
167
|
+
],
|
|
168
|
+
stopExcept: [
|
|
169
|
+
'продолжай', 'делай', 'работай', 'доделывай', 'иди дальше', 'делай дальше', 'сначала', 'спрашивать',
|
|
170
|
+
'спрашивай', 'asking', 'keep going', 'go on',
|
|
171
|
+
],
|
|
172
|
+
holdAfter: ['стоять', 'останавлива', 'ждать'],
|
|
173
|
+
nudge: '(?<![\\p{L}])(?<!не )(продолжай|доделывай|работай|делай дальше|работаешь)(?![\\p{L}])|почему (ты )?(стоишь|встал|остановил)|что дальше|дальше\\?|^(ну )?(и )?что там|^ну и\\s*[?!.]|какого .*останов',
|
|
174
|
+
write: [
|
|
175
|
+
'git commit', 'git push', 'git add', 'git merge', 'git rm', 'git mv', 'sed -i', 'perl -pi', 'gh pr', 'npm run task:new', 'pnpm run task:new', 'npm run task:move',
|
|
176
|
+
'pnpm run task:move', 'npm run agent-kit:sync', 'pnpm run agent-kit:sync',
|
|
177
|
+
],
|
|
178
|
+
menu: ['отложить RT-N', 'стоп'],
|
|
179
|
+
legacyBranches: ['RT-3276-conversation-checks', 'RT-3329-task-flow-scenario'],
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
expect: {
|
|
183
|
+
exit: { pattern: '^exit (\\d+)$', compare: 'exit' },
|
|
184
|
+
line: { pattern: '^`(.*)`$', compare: 'line' },
|
|
185
|
+
regex: { pattern: '^/(.*)/$', compare: 'regex' },
|
|
186
|
+
number: { pattern: '^(=|>=|<=) ?(-?\\d+)$', compare: 'number' },
|
|
187
|
+
},
|
|
188
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# The task flow
|
|
2
|
+
|
|
3
|
+
Generated by `flow-sync.mjs` from `flow.js` next to it. `flow-sync.mjs --check` refuses a hand edit:
|
|
4
|
+
the description is edited, and the generator is run.
|
|
5
|
+
|
|
6
|
+
<!-- flow:description -->
|
|
7
|
+
## States
|
|
8
|
+
|
|
9
|
+
| State | Exit | Mandatory action | Pattern |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `просьба-не-разобрана` | `measure.grill.written` | explore the tree, then ask the questions | `task-flow-start` |
|
|
12
|
+
| `эпик-заведён` | `measure.epic.declared` | take the epic branch from the main branch; the epic card moves with the first task | `epic-flow-declare` |
|
|
13
|
+
| `разбор-закрыт` | `measure.agreement.named` | write the product agreement, or the reason there is none | `task-flow-start` |
|
|
14
|
+
| `договорённость-записана` | `measure.task.taken` | create the task, the branch from the epic branch, and the folder | `task-flow-start` |
|
|
15
|
+
| `задача-взята` | `measure.plan.approved` | write the plan | `task-flow-start` |
|
|
16
|
+
| `замысел-записан` | `measure.progress.mirrors` | do the first stage | `task-flow-start` |
|
|
17
|
+
| `этап-идёт` | `measure.progress.done` | finish the stage: `step N.M` measures each step and marks it done | `task-flow-resume` |
|
|
18
|
+
| `этапы-кончились` | `measure.footprint.touched` | merge the agreement, bring the texts up to date, run the suite | `task-flow-close` |
|
|
19
|
+
| `разбор-кончился` | `measure.folder.archived` | take the folder apart by the last commit | `task-flow-archive` |
|
|
20
|
+
| `папка-разобрана` | `measure.pr.handed` | the work queue audit, then open the PR | `task-flow-close` |
|
|
21
|
+
| `работа-отдана` | `measure.epic.nextTaken` | send the rules review to the background, then take the next task of the epic | `task-flow-archive` |
|
|
22
|
+
| `влито` | `measure.epic.mergedMarked` | merge the PRs of the chain bottom-up, mark the merged tasks by the branch of the next one | `task-flow-resume` |
|
|
23
|
+
| `задачи-эпика-кончились` | `measure.epic.finished` | open the PR of the epic into the main branch | `task-flow-close` |
|
|
24
|
+
|
|
25
|
+
## Release cases
|
|
26
|
+
|
|
27
|
+
The engine asks the cases in this order, and a met case lets the turn end before the scenario does.
|
|
28
|
+
|
|
29
|
+
| Order | Case | When | Log |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| 1 | `scenarioEnd` | `any(measure.epic.finished, all(measure.copy.outsideEpic, measure.pr.handed))` | the end of the scenario |
|
|
32
|
+
| 2 | `stopWord` | `measure.owner.saidStop` | a stop word of the owner |
|
|
33
|
+
| 3 | `background` | `all(measure.session.waiting, not(measure.pr.handed))` | a background task of the session runs |
|
|
34
|
+
| 4 | `noWrite` | `any(measure.copy.outOfScenario, all(not(measure.session.wrote), not(measure.owner.nudged)))` | no write to the tree, or a branch outside the scenario |
|
|
35
|
+
| 5 | `role` | `measure.session.role` | a role session |
|
|
36
|
+
| 6 | `hostSilent` | `measure.host.silent` | the host did not answer twice |
|
|
37
|
+
| 8 | `menuLost` | `measure.session.menuLost` | the menu did not reach the owner |
|
|
38
|
+
|
|
39
|
+
## Measurers
|
|
40
|
+
|
|
41
|
+
| Measurer | Ports |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `measure.grill.written` | `source.git`, `source.tree` |
|
|
44
|
+
| `measure.epic.declared` | `source.git`, `source.host`, `source.tree` |
|
|
45
|
+
| `measure.epic.nextTaken` | `source.git`, `source.host`, `source.tree` |
|
|
46
|
+
| `measure.epic.mergedMarked` | `source.git`, `source.host`, `source.tree` |
|
|
47
|
+
| `measure.epic.finished` | `source.git`, `source.host`, `source.tree` |
|
|
48
|
+
| `measure.agreement.named` | `source.git`, `source.tree` |
|
|
49
|
+
| `measure.task.taken` | `source.git`, `source.host` |
|
|
50
|
+
| `measure.plan.approved` | `source.git`, `source.marks`, `source.steps`, `source.records` |
|
|
51
|
+
| `measure.progress.mirrors` | `source.git`, `source.steps` |
|
|
52
|
+
| `measure.progress.done` | `source.git`, `source.tree`, `source.marks`, `source.steps` |
|
|
53
|
+
| `measure.footprint.touched` | `source.git` |
|
|
54
|
+
| `measure.folder.archived` | `source.git` |
|
|
55
|
+
| `measure.pr.handed` | `source.git`, `source.host` |
|
|
56
|
+
| `measure.copy.outsideEpic` | `source.git`, `source.host`, `source.tree` |
|
|
57
|
+
| `measure.copy.outOfScenario` | `source.git`, `source.host`, `source.tree` |
|
|
58
|
+
| `measure.owner.saidStop` | `source.owner` |
|
|
59
|
+
| `measure.owner.nudged` | `source.owner` |
|
|
60
|
+
| `measure.session.wrote` | `source.session` |
|
|
61
|
+
| `measure.session.role` | `source.session` |
|
|
62
|
+
| `measure.session.menuLost` | `source.session` |
|
|
63
|
+
| `measure.session.forbidden` | `source.session` |
|
|
64
|
+
| `measure.session.idle` | `source.session` |
|
|
65
|
+
| `measure.session.unread` | `source.session` |
|
|
66
|
+
| `measure.session.waiting` | `source.session` |
|
|
67
|
+
| `measure.host.silent` | `source.host` |
|
|
68
|
+
|
|
69
|
+
## Sources
|
|
70
|
+
|
|
71
|
+
| Source | Ports |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `source.git.open` | none |
|
|
74
|
+
| `source.tree.open` | none |
|
|
75
|
+
| `source.host.open` | none |
|
|
76
|
+
| `source.marks.open` | none |
|
|
77
|
+
| `source.owner.open` | none |
|
|
78
|
+
| `source.session.open` | none |
|
|
79
|
+
| `source.steps.open` | none |
|
|
80
|
+
| `source.records.open` | none |
|
|
81
|
+
|
|
82
|
+
## Words
|
|
83
|
+
|
|
84
|
+
| Key | Words |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `stop` | стоп, стой, хватит, остановись, прекрати, не сейчас, подожди, погоди, жди, пауза, отбой, на сегодня всё, stop, wait, not now, pause |
|
|
87
|
+
| `stopExcept` | продолжай, делай, работай, доделывай, иди дальше, делай дальше, сначала, спрашивать, спрашивай, asking, keep going, go on |
|
|
88
|
+
| `holdAfter` | стоять, останавлива, ждать |
|
|
89
|
+
| `nudge` | `(?<![\p{L}])(?<!не )(продолжай\|доделывай\|работай\|делай дальше\|работаешь)(?![\p{L}])\|почему (ты )?(стоишь\|встал\|остановил)\|что дальше\|дальше\?\|^(ну )?(и )?что там\|^ну и\s*[?!.]\|какого .*останов` |
|
|
90
|
+
| `write` | git commit, git push, git add, git merge, git rm, git mv, sed -i, perl -pi, gh pr, npm run task:new, pnpm run task:new, npm run task:move, pnpm run task:move, npm run agent-kit:sync, pnpm run agent-kit:sync |
|
|
91
|
+
| `menu` | отложить RT-N, стоп |
|
|
92
|
+
| `legacyBranches` | RT-3276-conversation-checks, RT-3329-task-flow-scenario |
|
|
93
|
+
|
|
94
|
+
## Expected forms
|
|
95
|
+
|
|
96
|
+
| Form | Expected text | It matches when |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `exit` | `^exit (\d+)$` | the command exits with the code of the first group; the output is not compared |
|
|
99
|
+
| `line` | `` ^`(.*)`$ `` | the code is 0 and the last non-empty line of the output equals the first group |
|
|
100
|
+
| `regex` | `^/(.*)/$` | the code is 0 and the last non-empty line matches the first group |
|
|
101
|
+
| `number` | `^(=\|>=\|<=) ?(-?\d+)$` | the code is 0, the last non-empty line is an integer, and its comparison by the first group with the second holds |
|
|
102
|
+
<!-- /flow:description -->
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.agreement» — exit 3: the grill or the plan of the branch names the directory
|
|
3
|
+
* of the product agreement, found on disk or in the history, or the reason there is none. The forms
|
|
4
|
+
* of the line are those the task folder sample writes: `**Описание фичи:**`, `**Draft:**` and
|
|
5
|
+
* `**Spec:**` with a path, `**Описание фичи:** не нужно — <reason>` and
|
|
6
|
+
* `**Behaviour:** unchanged — <reason>`.
|
|
7
|
+
*/
|
|
8
|
+
import { agreementLines, taskFolder } from './text.mjs';
|
|
9
|
+
|
|
10
|
+
export function named({ git, tree }) {
|
|
11
|
+
return () => {
|
|
12
|
+
const branch = git.branch();
|
|
13
|
+
if (!branch) return false;
|
|
14
|
+
for (const file of ['grill.md', 'plan.md']) {
|
|
15
|
+
const path = `${taskFolder(branch)}/${file}`;
|
|
16
|
+
const text = tree.read(path) ?? git.lastVersion(path);
|
|
17
|
+
if (typeof text !== 'string') continue;
|
|
18
|
+
const { paths, reasons } = agreementLines(text);
|
|
19
|
+
if (reasons.length > 0) return true;
|
|
20
|
+
if (paths.some((p) => tree.exists(p) || git.everExisted(p))) return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.copy» — where the working copy stands against the scenario.
|
|
3
|
+
*
|
|
4
|
+
* outsideEpic — the work has no epic: the task card names none, or the copy of a branch without a
|
|
5
|
+
* task number leads no live epic. Outside an epic the scenario ends at exit 10.
|
|
6
|
+
*
|
|
7
|
+
* outOfScenario — the branch carries no task number, the copy leads no live epic, and no draft folder
|
|
8
|
+
* lies in the working copy: the engine has nothing to name as the next step. A draft keeps the copy
|
|
9
|
+
* in the scenario, measured by states 1–4.
|
|
10
|
+
*/
|
|
11
|
+
import { epicOfWork, workTask } from './epic-of.mjs';
|
|
12
|
+
|
|
13
|
+
export function outsideEpic({ git, host, tree }) {
|
|
14
|
+
return () => epicOfWork({ git, host, tree }) === null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function outOfScenario({ git, host, tree }) {
|
|
18
|
+
return () =>
|
|
19
|
+
workTask({ git, tree }) === null &&
|
|
20
|
+
epicOfWork({ git, host, tree }) === null &&
|
|
21
|
+
!tree.list('docs/tasks').some((name) => name.startsWith('_draft-'));
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The epic of the work, for the measurers that read it. The task the branch carries names its epic
|
|
3
|
+
* on the card. A branch without a task number takes the epic of the working copy from the assignment
|
|
4
|
+
* table; such an epic merged into the main branch or with its card closed counts as absent — the copy
|
|
5
|
+
* then leads nothing. The plan of the epic lies in the plans directory of the working copy.
|
|
6
|
+
*/
|
|
7
|
+
import { findEpicPlan, taskOfBranch } from './epic-text.mjs';
|
|
8
|
+
|
|
9
|
+
/** The plans directory of the tree. */
|
|
10
|
+
export const PLANS = 'docs/plans';
|
|
11
|
+
|
|
12
|
+
const planOf = (tree, number) =>
|
|
13
|
+
findEpicPlan(
|
|
14
|
+
tree
|
|
15
|
+
.list(PLANS)
|
|
16
|
+
.filter((name) => name.endsWith('.md'))
|
|
17
|
+
.map((name) => tree.read(`${PLANS}/${name}`) ?? ''),
|
|
18
|
+
number,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/** The epic of the copy is alive: its card is not closed and its PR into the main branch is not merged. */
|
|
22
|
+
const alive = (host, plan) => {
|
|
23
|
+
const card = host.issue(plan.epic);
|
|
24
|
+
if (card && !card.open) return false;
|
|
25
|
+
return !(plan.branch && host.pulls(plan.branch).some((p) => p.base === 'main' && p.state === 'MERGED'));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The task the branch carries, or null. The epic branch has the same form as a task branch — the key
|
|
30
|
+
* and a number — and reads as a branch without a task number: a plan of the epic with that number
|
|
31
|
+
* names it as its branch.
|
|
32
|
+
*/
|
|
33
|
+
export function workTask({ git, tree }) {
|
|
34
|
+
const branch = git.branch();
|
|
35
|
+
const number = taskOfBranch(branch);
|
|
36
|
+
if (number === null) return null;
|
|
37
|
+
return planOf(tree, number)?.branch === branch ? null : number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The plan of the epic of the work: { epic, branch, rows }, or null where there is none. */
|
|
41
|
+
export function epicOfWork({ git, host, tree }) {
|
|
42
|
+
const task = workTask({ git, tree });
|
|
43
|
+
if (task === null) {
|
|
44
|
+
const number = tree.copyEpic();
|
|
45
|
+
const plan = number === null ? null : planOf(tree, number);
|
|
46
|
+
return plan && alive(host, plan) ? plan : null;
|
|
47
|
+
}
|
|
48
|
+
const epic = host.issue(task)?.epic;
|
|
49
|
+
return epic === null || epic === undefined ? null : planOf(tree, Number(epic));
|
|
50
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* The plan of an epic: its number, its branch and the rows of its task table, in their order.
|
|
4
|
+
* A row is `| <#> | <KEY>-<n> — <name> | <state> |`; the state «отложено» defers the task,
|
|
5
|
+
* «влито» marks it merged. Any other state, the old mark «шаг владельца» among them, is an ordinary
|
|
6
|
+
* row.
|
|
7
|
+
*/
|
|
8
|
+
export function epicPlan(text) {
|
|
9
|
+
const epic = text.match(/\*\*Эпик:\*\*\s+[A-Z]+-(\d+)/)?.[1] ?? null;
|
|
10
|
+
const branch = text.match(/\*\*Ветка эпика:\*\*\s+`([^`]+)`/)?.[1] ?? null;
|
|
11
|
+
const rows = [];
|
|
12
|
+
for (const line of text.split('\n')) {
|
|
13
|
+
const m = line.match(/^\|\s*(?:\d+|—|-)\s*\|\s*[A-Z]+-(\d+)\b[^|]*\|\s*([^|]*?)\s*\|\s*$/);
|
|
14
|
+
if (!m) continue;
|
|
15
|
+
const state = m[2];
|
|
16
|
+
rows.push({
|
|
17
|
+
task: Number(m[1]),
|
|
18
|
+
state,
|
|
19
|
+
deferred: state === 'отложено',
|
|
20
|
+
merged: state === 'влито',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return { epic: epic === null ? null : Number(epic), branch, rows };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The plan of the epic numbered so among the texts of the plans directory, or null. */
|
|
27
|
+
export function findEpicPlan(texts, epic) {
|
|
28
|
+
return texts.map(epicPlan).find((p) => p.epic === epic) ?? null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The task number a branch name carries, by the key of the plan, or null. */
|
|
32
|
+
export function taskOfBranch(branch) {
|
|
33
|
+
const m = String(branch).match(/^[A-Z]+-(\d+)-[a-z0-9][a-z0-9-]*$/);
|
|
34
|
+
return m ? Number(m[1]) : null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.epic» — the exits that read the epic of the work: its plan in the plans
|
|
3
|
+
* directory, its branch and its card.
|
|
4
|
+
*
|
|
5
|
+
* declared — exit 2: the epic branch stands on the server or went into the main branch by the PR of
|
|
6
|
+
* the epic, and the epic card left the first column or is closed. Kept for the life of the branch
|
|
7
|
+
* once met.
|
|
8
|
+
*
|
|
9
|
+
* nextTaken — exit 11: every unmerged, unblocked task of the epic other than the current one has a
|
|
10
|
+
* branch, locally or on the server; with no such task the exit is met. A task is blocked when it is
|
|
11
|
+
* deferred. A task with a branch standing
|
|
12
|
+
* before a task without one does not meet the exit: the plan still holds work nobody took.
|
|
13
|
+
*
|
|
14
|
+
* mergedMarked — exit 12: every task not deferred with a merged PR of its branch is marked
|
|
15
|
+
* «влито», except the task merged last, whatever its row, and the task of the last row: the mark is
|
|
16
|
+
* set by the branch of the next task, and these have none. A mark on a task whose merged PR the
|
|
17
|
+
* hosting does not list counts while no branch of it is on the server and no PR of its branches is
|
|
18
|
+
* open or closed unmerged. Until then state 13 would demand the PR of
|
|
19
|
+
* an epic whose tasks are not in its branch.
|
|
20
|
+
*
|
|
21
|
+
* finished — exit 13: the tip of the branch of every task of the epic that is not deferred lies in
|
|
22
|
+
* the epic branch or in the main branch on the server, and the PR of the epic into the main branch
|
|
23
|
+
* exists in any state. The tip is the local branch, the branch on the server, or the head of its
|
|
24
|
+
* merged PR when the server removed the branch.
|
|
25
|
+
*/
|
|
26
|
+
import { epicOfWork } from './epic-of.mjs';
|
|
27
|
+
import { taskOfBranch } from './epic-text.mjs';
|
|
28
|
+
|
|
29
|
+
export function declared({ git, host, tree }) {
|
|
30
|
+
return () => {
|
|
31
|
+
const plan = epicOfWork({ git, host, tree });
|
|
32
|
+
if (!plan?.branch) return false;
|
|
33
|
+
const key = `exit2:${plan.epic}`;
|
|
34
|
+
if (host.recalled(key)) return true;
|
|
35
|
+
const onServer = host.remoteBranch(plan.branch) || host.pulls(plan.branch).some((p) => p.base === 'main' && p.state === 'MERGED');
|
|
36
|
+
const card = host.issue(plan.epic);
|
|
37
|
+
const met = onServer && card !== null && (!card.open || (card.status !== null && card.status !== 'backlog'));
|
|
38
|
+
if (met) host.remember(key);
|
|
39
|
+
return met;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A row the work does not wait for: deferred by the owner's word naming the task. */
|
|
44
|
+
const blocked = (row) => row.deferred;
|
|
45
|
+
|
|
46
|
+
const prefix = (task) => `RT-${task}-`;
|
|
47
|
+
|
|
48
|
+
export function nextTaken({ git, host, tree }) {
|
|
49
|
+
return () => {
|
|
50
|
+
const plan = epicOfWork({ git, host, tree });
|
|
51
|
+
if (!plan) return false;
|
|
52
|
+
const current = taskOfBranch(git.branch());
|
|
53
|
+
// A task with a merged PR is not ahead even unmarked: the hosting removes its branch on merge.
|
|
54
|
+
const merged = new Set(host.mergedPulls().map((p) => taskOfBranch(p.head)).filter((n) => n !== null));
|
|
55
|
+
const ahead = plan.rows.filter((row) => !row.merged && !merged.has(row.task) && row.task !== current && !blocked(row));
|
|
56
|
+
return ahead.every((row) => git.branches(prefix(row.task)).length > 0 || host.remoteBranches(prefix(row.task)).length > 0);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function mergedMarked({ git, host, tree }) {
|
|
61
|
+
return () => {
|
|
62
|
+
const plan = epicOfWork({ git, host, tree });
|
|
63
|
+
if (!plan) return false;
|
|
64
|
+
// The moment of the merge per task: the latest of its merged PRs.
|
|
65
|
+
const mergedAt = new Map();
|
|
66
|
+
for (const p of host.mergedPulls()) {
|
|
67
|
+
const task = taskOfBranch(p.head);
|
|
68
|
+
if (task === null) continue;
|
|
69
|
+
const at = p.mergedAt ?? '';
|
|
70
|
+
if (!mergedAt.has(task) || at > mergedAt.get(task)) mergedAt.set(task, at);
|
|
71
|
+
}
|
|
72
|
+
const live = plan.rows.filter((row) => !row.deferred);
|
|
73
|
+
// The task merged last has no next branch to mark it by: its merged PR counts alone. Tasks
|
|
74
|
+
// merged in the same second are all last.
|
|
75
|
+
const lastAt = [...live].filter((row) => mergedAt.has(row.task)).reduce((at, row) => (mergedAt.get(row.task) > at ? mergedAt.get(row.task) : at), '');
|
|
76
|
+
const isLast = (row) => mergedAt.has(row.task) && mergedAt.get(row.task) === lastAt;
|
|
77
|
+
// The last row has no next task either: a chain merged top-down leaves it merged before the rest.
|
|
78
|
+
const lastRow = live.at(-1) ?? null;
|
|
79
|
+
return live.every((row) => {
|
|
80
|
+
if (mergedAt.has(row.task)) return row.merged || isLast(row) || row === lastRow;
|
|
81
|
+
// A mark with no merged PR in view stands for a merge past the window of the hosting: the
|
|
82
|
+
// hosting removed its branch on merge, so a branch left on the server, or any PR of its
|
|
83
|
+
// branches open or closed unmerged, says the mark is ahead of the work.
|
|
84
|
+
return row.merged && !host.remoteBranches(prefix(row.task)).length && !openPullOrClosedUnmerged({ git, host }, row.task);
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A PR of a branch of the task is open or closed unmerged; the branches are the local and the server ones. */
|
|
90
|
+
const openPullOrClosedUnmerged = ({ git, host }, task) => {
|
|
91
|
+
const names = new Set([...git.branches(prefix(task)), ...host.remoteBranches(prefix(task))].map((b) => b.name));
|
|
92
|
+
return [...names].some((name) => host.pulls(name).some((p) => p.state === 'OPEN' || p.state === 'CLOSED'));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** The tip of the branch of a task: local, on the server, or the head of its merged PR. */
|
|
96
|
+
const tipOf = ({ git, host }, task) =>
|
|
97
|
+
git.branches(prefix(task))[0]?.sha ??
|
|
98
|
+
host.remoteBranches(prefix(task))[0]?.sha ??
|
|
99
|
+
host.mergedPulls().find((p) => taskOfBranch(p.head) === task)?.headRefOid ??
|
|
100
|
+
null;
|
|
101
|
+
|
|
102
|
+
export function finished({ git, host, tree }) {
|
|
103
|
+
return () => {
|
|
104
|
+
const plan = epicOfWork({ git, host, tree });
|
|
105
|
+
if (!plan?.branch) return false;
|
|
106
|
+
const landed = plan.rows
|
|
107
|
+
.filter((row) => !row.deferred)
|
|
108
|
+
.every((row) => {
|
|
109
|
+
const tip = tipOf({ git, host }, row.task);
|
|
110
|
+
return tip !== null && (host.inRemote(tip, plan.branch) || host.inRemote(tip, 'main'));
|
|
111
|
+
});
|
|
112
|
+
return landed && host.pulls(plan.branch).some((p) => p.base === 'main');
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.folder» — exit 9: one commit of the branch removed the task folder and added
|
|
3
|
+
* a record to the description of the past.
|
|
4
|
+
*/
|
|
5
|
+
import { taskFolder, under } from './text.mjs';
|
|
6
|
+
|
|
7
|
+
export function archived({ git }) {
|
|
8
|
+
return () => {
|
|
9
|
+
const branch = git.branch();
|
|
10
|
+
if (!branch) return false;
|
|
11
|
+
const folder = taskFolder(branch);
|
|
12
|
+
return git
|
|
13
|
+
.commits()
|
|
14
|
+
.some((c) => c.deleted.some((p) => under(p, folder)) && c.added.some((p) => under(p, 'docs/archive')));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.footprint» — exit 8: after the commit of the plan the branch changed at least
|
|
3
|
+
* one file under every path of every footprint row marked «(правится)», and the directory of the
|
|
4
|
+
* product agreement the grill or the plan names under `proposed/` is gone from the head. A plan
|
|
5
|
+
* without marked rows is judged by `proposed/` alone.
|
|
6
|
+
*/
|
|
7
|
+
import { agreementLines, footprintRows, taskFolder, touches } from './text.mjs';
|
|
8
|
+
|
|
9
|
+
export function touched({ git }) {
|
|
10
|
+
return () => {
|
|
11
|
+
const branch = git.branch();
|
|
12
|
+
if (!branch) return false;
|
|
13
|
+
const folder = taskFolder(branch);
|
|
14
|
+
const sha = git.addedBy(`${folder}/plan.md`);
|
|
15
|
+
if (!sha) return false;
|
|
16
|
+
const plan = git.versionAt(`${folder}/plan.md`, sha) ?? '';
|
|
17
|
+
const commits = git.commits();
|
|
18
|
+
const changed = commits
|
|
19
|
+
.slice(commits.findIndex((c) => c.sha === sha) + 1)
|
|
20
|
+
.flatMap((c) => [...c.added, ...c.deleted, ...c.modified]);
|
|
21
|
+
const rowsMet = footprintRows(plan)
|
|
22
|
+
.filter((row) => row.edited)
|
|
23
|
+
.every((row) => row.paths.every((path) => changed.some((file) => touches(file, path))));
|
|
24
|
+
const texts = [git.lastVersion(`${folder}/grill.md`), plan].filter((t) => typeof t === 'string');
|
|
25
|
+
const proposed = texts.flatMap((t) => agreementLines(t).paths).filter((p) => p.includes('/proposed/'));
|
|
26
|
+
return rowsMet && !proposed.some((p) => git.existsAtHead(p));
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.grill» — exit 1: the grill of the branch, or of a draft in the working copy,
|
|
3
|
+
* holds the owner's request as a quote and an answer. The grill of the branch is read from the
|
|
4
|
+
* working copy, and from the history once the folder is taken apart.
|
|
5
|
+
*/
|
|
6
|
+
import { grillAnswered, taskFolder } from './text.mjs';
|
|
7
|
+
|
|
8
|
+
export function written({ git, tree }) {
|
|
9
|
+
return () => {
|
|
10
|
+
const texts = [];
|
|
11
|
+
const branch = git.branch();
|
|
12
|
+
if (branch) {
|
|
13
|
+
const path = `${taskFolder(branch)}/grill.md`;
|
|
14
|
+
texts.push(tree.read(path) ?? git.lastVersion(path));
|
|
15
|
+
}
|
|
16
|
+
for (const name of tree.list('docs/tasks')) {
|
|
17
|
+
if (name.startsWith('_draft-')) texts.push(tree.read(`docs/tasks/${name}/grill.md`));
|
|
18
|
+
}
|
|
19
|
+
return texts.some((text) => typeof text === 'string' && grillAnswered(text));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.host» — the hosting did not answer: a read failed twice in this measurement.
|
|
3
|
+
* The engine reads it after the states, so it says whether the measured state stands on the silence.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function silent({ host }) {
|
|
7
|
+
return () => host.silent();
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The measurer «measure.owner» — what the owner's last word says about the turn: a stop, or a push
|
|
3
|
+
* to go on.
|
|
4
|
+
*/
|
|
5
|
+
/** The owner's last word begins with a stop word of `words.stop`, and nothing after it holds the turn. */
|
|
6
|
+
export function saidStop({ owner }) {
|
|
7
|
+
return ({ words, rules }) => {
|
|
8
|
+
const last = owner.last();
|
|
9
|
+
return last !== null && rules.saysStop(last, words);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The owner's last word pushes the work on by `words.nudge`, or names a task or an epic. */
|
|
14
|
+
export function nudged({ owner }) {
|
|
15
|
+
return ({ words }) => {
|
|
16
|
+
const last = owner.last();
|
|
17
|
+
if (last === null) return false;
|
|
18
|
+
return new RegExp(words.nudge ?? '(?!)', 'iu').test(last) || /(?<![\p{L}\d])[A-Z]+-\d+(?!\d)/u.test(last);
|
|
19
|
+
};
|
|
20
|
+
}
|