@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,292 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The parser of the task flow description language.
|
|
4
|
+
*
|
|
5
|
+
* The description is one object in parentheses closed by a semicolon: `({ … });`. It is read token
|
|
6
|
+
* by token and nothing in it is executed — a description that could run code would let any tree
|
|
7
|
+
* that installs the package run anything at the minute the engine reads it, and a reviewer would
|
|
8
|
+
* have to read it as code. So the grammar is narrow on purpose:
|
|
9
|
+
*
|
|
10
|
+
* value — a literal, a reference, a call of a reference, an array or an object;
|
|
11
|
+
* literal — a string in quotes, a number, `true`, `false`, `null`;
|
|
12
|
+
* reference — `section.name[.field…]` without quotes, the section one of the six;
|
|
13
|
+
* call — a reference followed by arguments in parentheses, the arguments values;
|
|
14
|
+
* array — values in brackets, a trailing comma allowed;
|
|
15
|
+
* object — `key: value` pairs in braces, the key a name or a string, a repeated key refused.
|
|
16
|
+
*
|
|
17
|
+
* Functions, operators, `new`, `require` and imports are refused with the place they stand at.
|
|
18
|
+
* Comments are skipped; a comment or a dot inside a string is the string's own text. Nothing may
|
|
19
|
+
* follow the closing `);` but whitespace and comments: a tail is where code would be hidden.
|
|
20
|
+
*
|
|
21
|
+
* The result is plain data: objects and arrays as such, a reference as a `Ref`, a call as a `Call`.
|
|
22
|
+
* Usage: node flow-syntax.mjs <file> — prints the model as JSON, or `flow syntax: <what> at L:C`
|
|
23
|
+
* and exits 1.
|
|
24
|
+
*/
|
|
25
|
+
import { readFileSync } from 'node:fs';
|
|
26
|
+
import { pathToFileURL } from 'node:url';
|
|
27
|
+
|
|
28
|
+
/** The sections a reference may start with. */
|
|
29
|
+
export const SECTIONS = ['source', 'measure', 'state', 'release', 'words', 'expect'];
|
|
30
|
+
|
|
31
|
+
const NAME = /^[A-Za-z][A-Za-z0-9]*$/;
|
|
32
|
+
const KEYWORDS = new Set(['true', 'false', 'null']);
|
|
33
|
+
const FORBIDDEN = new Set(['function', 'new', 'require', 'import', 'export', 'class', 'this', 'return', 'await', 'async', 'eval']);
|
|
34
|
+
|
|
35
|
+
/** A reference: `section.name[.field…]`. */
|
|
36
|
+
export class Ref {
|
|
37
|
+
constructor(path) {
|
|
38
|
+
this.path = path;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
toJSON() {
|
|
42
|
+
return { ref: this.path.join('.') };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A call of a reference with arguments. */
|
|
47
|
+
export class Call {
|
|
48
|
+
constructor(ref, args) {
|
|
49
|
+
this.ref = ref;
|
|
50
|
+
this.args = args;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
toJSON() {
|
|
54
|
+
return { call: this.ref.path.join('.'), args: this.args };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A refusal of the parser: what is wrong and where. */
|
|
59
|
+
export class FlowSyntaxError extends Error {
|
|
60
|
+
constructor(what, line, column) {
|
|
61
|
+
super(`${what} at ${line}:${column}`);
|
|
62
|
+
this.what = what;
|
|
63
|
+
this.line = line;
|
|
64
|
+
this.column = column;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function tokenize(text) {
|
|
69
|
+
const tokens = [];
|
|
70
|
+
let at = 0;
|
|
71
|
+
let line = 1;
|
|
72
|
+
let column = 1;
|
|
73
|
+
|
|
74
|
+
const advance = (count) => {
|
|
75
|
+
for (let i = 0; i < count; i += 1) {
|
|
76
|
+
if (text[at] === '\n') {
|
|
77
|
+
line += 1;
|
|
78
|
+
column = 1;
|
|
79
|
+
} else {
|
|
80
|
+
column += 1;
|
|
81
|
+
}
|
|
82
|
+
at += 1;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const fail = (what) => {
|
|
86
|
+
throw new FlowSyntaxError(what, line, column);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
while (at < text.length) {
|
|
90
|
+
const ch = text[at];
|
|
91
|
+
const next = text[at + 1];
|
|
92
|
+
|
|
93
|
+
if (/\s/.test(ch)) {
|
|
94
|
+
advance(1);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (ch === '/' && next === '/') {
|
|
99
|
+
while (at < text.length && text[at] !== '\n') advance(1);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (ch === '/' && next === '*') {
|
|
104
|
+
const end = text.indexOf('*/', at + 2);
|
|
105
|
+
if (end < 0) fail('an unclosed comment');
|
|
106
|
+
advance(end + 2 - at);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const start = { line, column };
|
|
111
|
+
|
|
112
|
+
if (ch === "'" || ch === '"') {
|
|
113
|
+
let value = '';
|
|
114
|
+
advance(1);
|
|
115
|
+
for (;;) {
|
|
116
|
+
if (at >= text.length || text[at] === '\n') fail('an unclosed string');
|
|
117
|
+
const c = text[at];
|
|
118
|
+
if (c === ch) {
|
|
119
|
+
advance(1);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (c === '\\') {
|
|
123
|
+
const e = text[at + 1];
|
|
124
|
+
const map = { n: '\n', t: '\t', '\\': '\\', "'": "'", '"': '"' };
|
|
125
|
+
if (!(e in map)) fail(`an unknown escape \\${e ?? ''} in a string`);
|
|
126
|
+
value += map[e];
|
|
127
|
+
advance(2);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
value += c;
|
|
131
|
+
advance(1);
|
|
132
|
+
}
|
|
133
|
+
tokens.push({ type: 'string', value, ...start });
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (/[0-9]/.test(ch) || (ch === '-' && /[0-9]/.test(next ?? ''))) {
|
|
138
|
+
const m = /^-?[0-9]+(\.[0-9]+)?/.exec(text.slice(at));
|
|
139
|
+
advance(m[0].length);
|
|
140
|
+
if (/[A-Za-z_$]/.test(text[at] ?? '')) fail('a name glued to a number');
|
|
141
|
+
tokens.push({ type: 'number', value: Number(m[0]), ...start });
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (/[A-Za-z_$]/.test(ch)) {
|
|
146
|
+
const m = /^[A-Za-z_$][A-Za-z0-9_$]*/.exec(text.slice(at));
|
|
147
|
+
const word = m[0];
|
|
148
|
+
if (FORBIDDEN.has(word)) fail(`«${word}» is not allowed: the description executes nothing`);
|
|
149
|
+
if (!NAME.test(word)) fail(`the name «${word}» is outside [A-Za-z][A-Za-z0-9]*`);
|
|
150
|
+
advance(word.length);
|
|
151
|
+
tokens.push({ type: 'name', value: word, ...start });
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if ('(){}[],:;.'.includes(ch)) {
|
|
156
|
+
advance(1);
|
|
157
|
+
tokens.push({ type: 'punct', value: ch, ...start });
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (ch === '=' && next === '>') fail('an arrow function is not allowed: the description executes nothing');
|
|
162
|
+
if (ch === '`') fail('a template string is not allowed: the description executes nothing');
|
|
163
|
+
fail(`«${ch}» is an operator: an expression is not allowed, only values`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
tokens.push({ type: 'end', value: null, line, column });
|
|
167
|
+
return tokens;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Parses a description into plain data. Throws `FlowSyntaxError`. */
|
|
171
|
+
export function parse(text) {
|
|
172
|
+
const tokens = tokenize(text);
|
|
173
|
+
let at = 0;
|
|
174
|
+
|
|
175
|
+
const peek = () => tokens[at];
|
|
176
|
+
const fail = (what, token = peek()) => {
|
|
177
|
+
throw new FlowSyntaxError(what, token.line, token.column);
|
|
178
|
+
};
|
|
179
|
+
const describe = (token) => (token.type === 'end' ? 'the end' : `«${token.value}»`);
|
|
180
|
+
const expect = (value) => {
|
|
181
|
+
const token = peek();
|
|
182
|
+
if (token.type !== 'punct' || token.value !== value) fail(`«${value}» expected, ${describe(token)} found`);
|
|
183
|
+
at += 1;
|
|
184
|
+
return token;
|
|
185
|
+
};
|
|
186
|
+
const isPunct = (value) => peek().type === 'punct' && peek().value === value;
|
|
187
|
+
|
|
188
|
+
function reference() {
|
|
189
|
+
const first = peek();
|
|
190
|
+
at += 1;
|
|
191
|
+
if (!SECTIONS.includes(first.value)) {
|
|
192
|
+
fail(`«${first.value}» is not a section: a reference starts with ${SECTIONS.join(', ')}`, first);
|
|
193
|
+
}
|
|
194
|
+
const path = [first.value];
|
|
195
|
+
while (isPunct('.')) {
|
|
196
|
+
at += 1;
|
|
197
|
+
const part = peek();
|
|
198
|
+
if (part.type !== 'name') fail(`a name expected after the dot, ${describe(part)} found`);
|
|
199
|
+
path.push(part.value);
|
|
200
|
+
at += 1;
|
|
201
|
+
}
|
|
202
|
+
if (path.length < 2) fail(`a reference names a section and an entry: «${first.value}.<name>»`, first);
|
|
203
|
+
const ref = new Ref(path);
|
|
204
|
+
if (!isPunct('(')) return ref;
|
|
205
|
+
at += 1;
|
|
206
|
+
const args = [];
|
|
207
|
+
while (!isPunct(')')) {
|
|
208
|
+
args.push(value());
|
|
209
|
+
if (isPunct(',')) at += 1;
|
|
210
|
+
else if (!isPunct(')')) fail(`«,» or «)» expected, ${describe(peek())} found`);
|
|
211
|
+
}
|
|
212
|
+
at += 1;
|
|
213
|
+
return new Call(ref, args);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function array() {
|
|
217
|
+
expect('[');
|
|
218
|
+
const items = [];
|
|
219
|
+
while (!isPunct(']')) {
|
|
220
|
+
items.push(value());
|
|
221
|
+
if (isPunct(',')) at += 1;
|
|
222
|
+
else if (!isPunct(']')) fail(`«,» or «]» expected, ${describe(peek())} found`);
|
|
223
|
+
}
|
|
224
|
+
at += 1;
|
|
225
|
+
return items;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function object() {
|
|
229
|
+
expect('{');
|
|
230
|
+
const result = {};
|
|
231
|
+
const seen = new Set();
|
|
232
|
+
while (!isPunct('}')) {
|
|
233
|
+
const key = peek();
|
|
234
|
+
if (key.type !== 'name' && key.type !== 'string') fail(`a key expected, ${describe(key)} found`);
|
|
235
|
+
if (key.type === 'name' && KEYWORDS.has(key.value)) fail(`«${key.value}» cannot be a key`);
|
|
236
|
+
if (seen.has(key.value)) fail(`the key «${key.value}» repeats`, key);
|
|
237
|
+
seen.add(key.value);
|
|
238
|
+
at += 1;
|
|
239
|
+
expect(':');
|
|
240
|
+
Object.defineProperty(result, key.value, { value: value(), enumerable: true, writable: true, configurable: true });
|
|
241
|
+
if (isPunct(',')) at += 1;
|
|
242
|
+
else if (!isPunct('}')) fail(`«,» or «}» expected, ${describe(peek())} found`);
|
|
243
|
+
}
|
|
244
|
+
at += 1;
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function value() {
|
|
249
|
+
const token = peek();
|
|
250
|
+
if (token.type === 'string' || token.type === 'number') {
|
|
251
|
+
at += 1;
|
|
252
|
+
return token.value;
|
|
253
|
+
}
|
|
254
|
+
if (token.type === 'name') {
|
|
255
|
+
if (token.value === 'true' || token.value === 'false') {
|
|
256
|
+
at += 1;
|
|
257
|
+
return token.value === 'true';
|
|
258
|
+
}
|
|
259
|
+
if (token.value === 'null') {
|
|
260
|
+
at += 1;
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return reference();
|
|
264
|
+
}
|
|
265
|
+
if (isPunct('[')) return array();
|
|
266
|
+
if (isPunct('{')) return object();
|
|
267
|
+
return fail(`a value expected, ${describe(token)} found`);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
expect('(');
|
|
271
|
+
if (!isPunct('{')) fail(`the description is one object: «({» expected, ${describe(peek())} found`);
|
|
272
|
+
const model = object();
|
|
273
|
+
expect(')');
|
|
274
|
+
expect(';');
|
|
275
|
+
if (peek().type !== 'end') fail(`nothing may follow «);», ${describe(peek())} found`);
|
|
276
|
+
return model;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
280
|
+
const file = process.argv[2];
|
|
281
|
+
if (!file) {
|
|
282
|
+
console.error('usage: node flow-syntax.mjs <file>');
|
|
283
|
+
process.exit(2);
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
console.log(JSON.stringify(parse(readFileSync(file, 'utf8'))));
|
|
287
|
+
} catch (error) {
|
|
288
|
+
if (!(error instanceof FlowSyntaxError)) throw error;
|
|
289
|
+
console.log(`flow syntax: ${error.message}`);
|
|
290
|
+
process.exit(1);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The verdict at the end of a turn — the engine command `verdict`, called by the hook on Stop.
|
|
3
|
+
*
|
|
4
|
+
* The turn is released by the first release case of the description whose condition is met, in the
|
|
5
|
+
* order of the cases; otherwise it is held, and the refusal names one move: the next step of the
|
|
6
|
+
* scenario. In the state where the stages go on, that move is the current step of the progress and
|
|
7
|
+
* the command that measures it.
|
|
8
|
+
*
|
|
9
|
+
* When another check refused the same step twice for the same reason, or the executor stopped again
|
|
10
|
+
* with no call after the previous refusal,
|
|
11
|
+
* the one move is the owner's menu: the options of `words.menu`, with the number of the task put in.
|
|
12
|
+
*
|
|
13
|
+
* The case of the silent hosting counts only when the measurement itself stopped on the silence: a
|
|
14
|
+
* read that failed for a state passed over says nothing when a later local exit is unmet. Any other
|
|
15
|
+
* case the hosting could not answer is not met.
|
|
16
|
+
*/
|
|
17
|
+
import { evaluateCondition } from './flow-condition.mjs';
|
|
18
|
+
import { stepsOfProgress } from './work-steps-lib.mjs';
|
|
19
|
+
|
|
20
|
+
/** The measurer whose answer depends on where the measurement stopped. */
|
|
21
|
+
const SILENCE = 'measure.host.silent';
|
|
22
|
+
|
|
23
|
+
/** The measurers that name why the next move is the owner's menu. */
|
|
24
|
+
const MENU_CAUSES = { unread: 'measure.session.unread', forbidden: 'measure.session.forbidden', idle: 'measure.session.idle' };
|
|
25
|
+
|
|
26
|
+
/** The first release case met, or null. `read` answers a measurer by its reference. */
|
|
27
|
+
export function releaseCase(model, read, result) {
|
|
28
|
+
const stoppedOnSilence = result.state !== null && result.reason !== null;
|
|
29
|
+
const answer = (name) => {
|
|
30
|
+
try {
|
|
31
|
+
return read(name);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
// A case the hosting could not answer is not met: an unknown fact releases nothing.
|
|
34
|
+
if (error?.name === 'HostSilent') return false;
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const reader = (name) => (name === SILENCE ? stoppedOnSilence && answer(name) : answer(name));
|
|
39
|
+
return model.release.find((entry) => evaluateCondition(entry.when, reader)) ?? null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Why the next move is the owner's menu: { by: '<guard>' }, { idle: true }, or null. A measurer the
|
|
44
|
+
* description does not declare, or the hosting could not answer, names no cause. An unread
|
|
45
|
+
* background task comes first, { unread: { task, output, agent } }: while it is unread the move is to
|
|
46
|
+
* read it, and no menu is offered.
|
|
47
|
+
*/
|
|
48
|
+
export function menuCause(read) {
|
|
49
|
+
const answer = (name) => {
|
|
50
|
+
try {
|
|
51
|
+
return read(name);
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const unread = answer(MENU_CAUSES.unread);
|
|
57
|
+
if (unread) return { unread };
|
|
58
|
+
const by = answer(MENU_CAUSES.forbidden);
|
|
59
|
+
if (by) return { by: String(by) };
|
|
60
|
+
return answer(MENU_CAUSES.idle) ? { idle: true } : null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The options of the owner's menu: `words.menu`, the number of the task put in place of N. */
|
|
64
|
+
export function menuOptions(words, task) {
|
|
65
|
+
return (words.menu ?? []).map((option) => (task ? option.replace(/RT-N$/, `RT-${task}`) : option));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The current step of a progress text and the count of steps not done: { number, name, left }, or null. */
|
|
69
|
+
export function currentStep(progress) {
|
|
70
|
+
const steps = stepsOfProgress(progress ?? '').steps;
|
|
71
|
+
const step = steps.find((s) => s.mark === '>');
|
|
72
|
+
return step ? { number: step.number, name: step.name, left: steps.filter((s) => s.mark !== 'x').length } : null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The reason of a held turn: the measured state, its action, and the step when the stages go on. With a
|
|
77
|
+
* cause of the menu the one move is the owner's menu instead.
|
|
78
|
+
*/
|
|
79
|
+
export function holdReason(model, result, step, menu = null) {
|
|
80
|
+
const total = model.states.length;
|
|
81
|
+
const state = model.states[result.index - 1];
|
|
82
|
+
const lines = [`The scenario is not over: the work stands in the state \`${result.state}\` (${result.index} of ${total}), whose exit is not met.`];
|
|
83
|
+
if (menu?.cause?.unread) {
|
|
84
|
+
const { task, output, agent } = menu.cause.unread;
|
|
85
|
+
if (agent) {
|
|
86
|
+
lines.push(`The background agent \`${task}\` ended after the last call, and its notice has not been read.`);
|
|
87
|
+
lines.push('The first move is to take its report from the notice and act on it. No owner\'s menu is offered while it is unread.');
|
|
88
|
+
} else {
|
|
89
|
+
const where = output ? ` — its output is \`${output}\`` : '';
|
|
90
|
+
lines.push(`The background task \`${task}\` ended after the last call, and its notice has not been read${where}.`);
|
|
91
|
+
lines.push('The first move is to read that output and act on it: a red result is fixed now. No owner\'s menu is offered while the task is unread.');
|
|
92
|
+
}
|
|
93
|
+
} else if (menu?.cause) {
|
|
94
|
+
lines.push(
|
|
95
|
+
menu.cause.idle
|
|
96
|
+
? 'The previous refusal named a move, and no call followed it.'
|
|
97
|
+
: `The check \`${menu.cause.by}\` refused the same step twice for the same reason.`,
|
|
98
|
+
);
|
|
99
|
+
const options = menuOptions(model.words, menu.task);
|
|
100
|
+
lines.push(`The one move is the owner's menu: ask through the question tool with exactly these options — ${options.map((o) => `«${o}»`).join(', ')}.`);
|
|
101
|
+
lines.push('Then do what the owner chose: a deferral marks the task «отложено» in the plan of the epic and takes the next unblocked task; «стоп» ends the turn.');
|
|
102
|
+
return lines.join('\n');
|
|
103
|
+
}
|
|
104
|
+
if (step && state?.key === 'stage') {
|
|
105
|
+
lines.push(`${step.left} steps of the plan are not done, counted by \`node tools/check-work-steps.mjs\`.`);
|
|
106
|
+
lines.push(`The next move is step ${step.number} «${step.name}»: do it, then measure it — \`node tools/task-flow-script.mjs step ${step.number}\`.`);
|
|
107
|
+
} else {
|
|
108
|
+
lines.push(`The next move is the action of this state: ${state?.action ?? ''} (pattern \`${state?.pattern ?? ''}\`).`);
|
|
109
|
+
}
|
|
110
|
+
lines.push('`node tools/task-flow-script.mjs measure` names the exits read.');
|
|
111
|
+
return lines.join('\n');
|
|
112
|
+
}
|
|
@@ -43,7 +43,13 @@ const COMMON_DOMAIN_LAYERS = [...FLAT_LAYERS, 'feature'].sort();
|
|
|
43
43
|
const API_DOMAIN_LAYERS = ['api', 'data-access', 'feature', 'util'];
|
|
44
44
|
/** Where libs that ended up outside the domain grid are looked for */
|
|
45
45
|
const LIB_ROOTS = [...FAMILIES, ...API_FAMILIES].map((family) => `${LIBS_ROOT}/${family}`);
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The files every lib has. The test runner is not among them: it is declared in one of two forms,
|
|
48
|
+
* and `lib-manifests.mjs` judges that on its own.
|
|
49
|
+
*/
|
|
50
|
+
const REQUIRED_FILES = ['project.json', 'tsconfig.json', 'src/index.ts'];
|
|
51
|
+
/** The executor that runs the tests of a lib through the Angular builder */
|
|
52
|
+
const ANGULAR_TEST_EXECUTOR = '@angular/build:unit-test';
|
|
47
53
|
const BOUNDARIES_DIR = 'eslint/boundaries/domains';
|
|
48
54
|
|
|
49
55
|
const problems = [];
|
|
@@ -51,7 +57,8 @@ const report = (path, message) => problems.push(`${path}: ${message}`);
|
|
|
51
57
|
|
|
52
58
|
const readJson = (path) => JSON.parse(readFileSync(join(ROOT, path), 'utf8'));
|
|
53
59
|
const isDir = (path) => existsSync(join(ROOT, path)) && statSync(join(ROOT, path)).isDirectory();
|
|
54
|
-
|
|
60
|
+
/** The sources of a lib and everything the tree never walks into. */
|
|
61
|
+
const IGNORED_DIRS = ['src', ...CONFIG.skippedDirs];
|
|
55
62
|
const dirsIn = (path) =>
|
|
56
63
|
isDir(path)
|
|
57
64
|
? readdirSync(join(ROOT, path), { withFileTypes: true })
|
|
@@ -187,6 +194,7 @@ export {
|
|
|
187
194
|
API_DOMAIN_LAYERS,
|
|
188
195
|
LIB_ROOTS,
|
|
189
196
|
REQUIRED_FILES,
|
|
197
|
+
ANGULAR_TEST_EXECUTOR,
|
|
190
198
|
BOUNDARIES_DIR,
|
|
191
199
|
IGNORED_DIRS,
|
|
192
200
|
allowlist,
|
|
@@ -196,7 +196,7 @@ function collectStrayLibs(knownLibs) {
|
|
|
196
196
|
* layers by their make-up — a domain is one lib — but everything else is checked on a par with
|
|
197
197
|
* the domain grid. Before the narrowing, the exception on this root took off from them the
|
|
198
198
|
* make-up of the files, the tag and the alias too: a new lib was started without
|
|
199
|
-
*
|
|
199
|
+
* a test runner, and `nx test` silently ran not a single test over it.
|
|
200
200
|
*/
|
|
201
201
|
function collectFlatLibs() {
|
|
202
202
|
return [...(allowlist.flatLibRoots?.keys() ?? [])]
|
|
@@ -6,12 +6,43 @@
|
|
|
6
6
|
* The name does not begin with `check-`: by walking such names the package default assembles the
|
|
7
7
|
* push gate set, and a helper with one would be run by the gate as a check of its own.
|
|
8
8
|
*/
|
|
9
|
-
import { existsSync } from 'node:fs';
|
|
9
|
+
import { existsSync, statSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
|
|
12
|
-
import { LIB_PREFIX, REQUIRED_FILES, declaredAlias, importAlias, libTag, projectName, readJson, report } from './lib-common.mjs';
|
|
12
|
+
import { ANGULAR_TEST_EXECUTOR, LIB_PREFIX, REQUIRED_FILES, declaredAlias, importAlias, libTag, projectName, readJson, report } from './lib-common.mjs';
|
|
13
13
|
import { ROOT } from './rt-kit-checks.config.mjs';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A lib runs its tests in one of two forms: its own `vitest.config.mts`, or the Angular builder.
|
|
17
|
+
* The second counts only when all three hold at once: `project.json` declares the `test` target on
|
|
18
|
+
* the executor `@angular/build:unit-test`, `options.tsConfig` names a file that exists on disk, and
|
|
19
|
+
* the lib has its own `tsconfig.spec.json`. A lib with both forms is not an error.
|
|
20
|
+
*/
|
|
21
|
+
function checkTestRunner(libPath, project) {
|
|
22
|
+
if (existsSync(join(ROOT, libPath, 'vitest.config.mts'))) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const expected = `a lib needs a test runner: either ${libPath}/vitest.config.mts, or a \`test\` target on the executor ${ANGULAR_TEST_EXECUTOR} with options.tsConfig pointing at an existing file, together with its own ${libPath}/tsconfig.spec.json`;
|
|
26
|
+
const target = project.targets?.test;
|
|
27
|
+
if (!target) {
|
|
28
|
+
report(libPath, `no file vitest.config.mts and no \`test\` target in project.json; ${expected}`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (target.executor !== ANGULAR_TEST_EXECUTOR) {
|
|
32
|
+
report(libPath, `no file vitest.config.mts, and the \`test\` target ${target.executor ? `runs on «${target.executor}»` : 'names no executor'}; ${expected}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const tsConfig = target.options?.tsConfig;
|
|
36
|
+
if (typeof tsConfig !== 'string' || tsConfig === '') {
|
|
37
|
+
report(libPath, `no file vitest.config.mts, and the \`test\` target names no options.tsConfig; ${expected}`);
|
|
38
|
+
} else if (!existsSync(join(ROOT, tsConfig)) || !statSync(join(ROOT, tsConfig)).isFile()) {
|
|
39
|
+
report(libPath, `no file vitest.config.mts, and options.tsConfig «${tsConfig}» is not an existing file; ${expected}`);
|
|
40
|
+
}
|
|
41
|
+
if (!existsSync(join(ROOT, libPath, 'tsconfig.spec.json'))) {
|
|
42
|
+
report(libPath, `no file vitest.config.mts, and no file tsconfig.spec.json; ${expected}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
15
46
|
function checkLib(libPath, { requirePrefix = true } = {}) {
|
|
16
47
|
for (const file of REQUIRED_FILES) {
|
|
17
48
|
if (!existsSync(join(ROOT, libPath, file))) {
|
|
@@ -24,6 +55,7 @@ function checkLib(libPath, { requirePrefix = true } = {}) {
|
|
|
24
55
|
}
|
|
25
56
|
|
|
26
57
|
const project = readJson(`${libPath}/project.json`);
|
|
58
|
+
checkTestRunner(libPath, project);
|
|
27
59
|
// The name the tree wrote down is the name. The formula speaks only where nothing is written:
|
|
28
60
|
// it says what the name must become, and judging a declared name by it reddens a lib that
|
|
29
61
|
// breaks nothing.
|