@rt-tools/agent-kit 0.23.0 → 0.26.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 +8 -2
- package/assets/agents/business-analyst.md +51 -50
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epics.github.mjs +75 -41
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +24 -24
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +150 -128
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +179 -157
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +104 -82
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +79 -70
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +125 -33
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +87 -83
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +174 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/task-new.github.mjs +85 -56
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +115 -91
- package/assets/defaults/project.sh +228 -178
- package/assets/defaults/shell.sh +85 -65
- package/assets/defaults/turn-map.md +45 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +12 -12
- package/assets/hooks/browser-guard-device-id.sh +46 -14
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +11 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +46 -43
- package/assets/hooks/dispatch.sh +84 -39
- package/assets/hooks/docs-guard.sh +105 -86
- package/assets/hooks/exam-guard.sh +146 -84
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +85 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +88 -52
- package/assets/hooks/git-guard-delivery.sh +207 -253
- package/assets/hooks/git-guard-main.sh +65 -26
- package/assets/hooks/git-guard-push-tests.sh +133 -75
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +26 -24
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +70 -50
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +19 -17
- package/assets/hooks/qa-dataid-guard.sh +52 -49
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +36 -34
- package/assets/hooks/rule-source-guard.sh +52 -36
- package/assets/hooks/skill-gate-layers.sh +59 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +6 -6
- package/assets/hooks/sql-guard-parse.sh +68 -66
- package/assets/hooks/sql-guard-request.sh +48 -46
- package/assets/hooks/sql-guard-target.sh +57 -51
- package/assets/hooks/sql-guard-write.sh +84 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +104 -0
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +256 -204
- package/assets/hooks/turn-exit-patterns.sh +53 -0
- package/assets/hooks/utf8.sh +11 -11
- package/assets/hooks/waiting-turn-guard.sh +94 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +115 -30
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +148 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -114
- package/assets/laws/work-conduct.md +250 -250
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +143 -67
- package/assets/patterns/browser-verification-stand.md +181 -128
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +93 -0
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +94 -75
- package/assets/patterns/git-workflow-commit.github.md +153 -129
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +99 -86
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +126 -121
- package/assets/patterns/git-workflow-pr.github.md +179 -175
- package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +131 -106
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +37 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +215 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +204 -192
- package/assets/patterns/testing-e2e.md +103 -92
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +152 -141
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +264 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +75 -74
- package/assets/rules/browser-verification.md +223 -188
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +209 -148
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +250 -242
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -137
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +83 -72
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -188
- package/assets/rules/turn-conduct.md +255 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +236 -222
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +68 -4
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +13 -4
- package/lib/enroll.js.map +1 -1
- package/lib/observations.d.ts +10 -1
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js +1 -0
- package/lib/observations.js.map +1 -1
- package/lib/override-marks.d.ts +24 -0
- package/lib/override-marks.d.ts.map +1 -0
- package/lib/override-marks.js +98 -0
- package/lib/override-marks.js.map +1 -0
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +0 -7
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +10 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +7 -3
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.26.0.tgz +0 -0
- package/rt-tools-agent-kit-0.23.0.tgz +0 -0
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The check of style: officialese and turns of phrase that are not written in this tree.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The rule about texts requires plain words, and there was no check for that: the law left the
|
|
6
|
+
* wording agreements entirely to the author, and they held by the memory of whoever writes. They
|
|
7
|
+
* held badly — the owner reads what is written and sees machine style where the agreement requires
|
|
8
|
+
* a human one.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* What is caught is not style in general but the listed signs, and each is named together with its
|
|
11
|
+
* replacement: a list of bans without replacements reads as a ban on writing, and the author
|
|
12
|
+
* bypasses it instead of fixing the text.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* What the check does not see and will not see: coherence, a thought said twice, the truth of a
|
|
15
|
+
* statement. A paragraph of short sentences with clean words passes it whole while meaning nothing
|
|
16
|
+
* by that. This is its boundary, not its promise.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
+
* A non-zero return code and a list of findings: the file, the line, what was found, what to
|
|
19
|
+
* replace it with.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
+
* Word boundaries are written with a look at letters, not `\b`: it counts by ASCII, Cyrillic does
|
|
22
|
+
* not fall under `\w`, and a pattern with it silently never fires once.
|
|
21
23
|
*/
|
|
22
24
|
import { readFileSync } from 'node:fs';
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
import { CONFIG } from './rt-kit-checks.config.mjs';
|
|
27
|
+
|
|
28
|
+
/** The sentence length limit in words. Beyond it the reader loses the beginning. */
|
|
25
29
|
const WORDS_LIMIT = 40;
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
32
|
+
* The signs of officialese. Each is a pattern and what to replace it with: without a replacement
|
|
33
|
+
* a finding reads as a ban on writing.
|
|
30
34
|
*/
|
|
31
35
|
const MARKS = [
|
|
32
36
|
[/(?<![а-яёА-ЯЁ])является(?![а-яёА-ЯЁ])/giu, 'сказать глаголом: «это», «работает», «стоит»'],
|
|
@@ -39,7 +43,16 @@ const MARKS = [
|
|
|
39
43
|
[/(?<![а-яёА-ЯЁ])в рамках(?![а-яёА-ЯЁ])/giu, 'назвать отношение прямо: «в», «при», «для»'],
|
|
40
44
|
[/(?<![а-яёА-ЯЁ])на основании(?![а-яёА-ЯЁ])/giu, '«по»'],
|
|
41
45
|
[/(?<![а-яёА-ЯЁ])посредством(?![а-яёА-ЯЁ])/giu, '«через», «командой», «вызовом»'],
|
|
42
|
-
[/(?<![а-яёА-ЯЁ])данн(
|
|
46
|
+
[/(?<![а-яёА-ЯЁ])данн(ый|ая|ое)(?![а-яёА-ЯЁ])/giu, '«этот» или ничего'],
|
|
47
|
+
// The form «данные» is also a noun, and there is nothing to replace it with: the data of a
|
|
48
|
+
// stand is data. So it is checked by what stands after it: as a pronoun it reads before the
|
|
49
|
+
// word it qualifies itself. The list of stems is deliberately short — what is recognised is
|
|
50
|
+
// what has been met, and a false refusal here costs more than a miss: the check stands in the
|
|
51
|
+
// set of the push gate, and red on a word that has no replacement stops the work entirely.
|
|
52
|
+
[
|
|
53
|
+
/(?<![а-яёА-ЯЁ])данные\s+(требовани|услови|значени|обстоятельств|сведени|фактор|параметр|вопрос|правил|подход|принцип|случа)[а-яё]*/giu,
|
|
54
|
+
'«эти» или ничего',
|
|
55
|
+
],
|
|
43
56
|
[/(?<![а-яёА-ЯЁ])соответствующ(ий|ая|ее|ие)(?![а-яёА-ЯЁ])/giu, 'назвать, чему именно соответствует'],
|
|
44
57
|
[/(?<![а-яёА-ЯЁ])необходимо(?![а-яёА-ЯЁ])/giu, '«надо» или повелительное наклонение'],
|
|
45
58
|
[/(?<![а-яёА-ЯЁ])должен быть (выполнен|произведён|осуществлён)(?![а-яёА-ЯЁ])/giu, 'сказать, кто это делает'],
|
|
@@ -50,7 +63,40 @@ const MARKS = [
|
|
|
50
63
|
[/(?<![а-яёА-ЯЁ])как уже было сказано(?![а-яёА-ЯЁ])/giu, 'убрать: сказанное дважды не становится вернее'],
|
|
51
64
|
];
|
|
52
65
|
|
|
53
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The signs of officialese in English text. The rules layer is written in English, and the Russian
|
|
68
|
+
* set stays silent on it: a pattern with a Cyrillic boundary matches no Latin word at all.
|
|
69
|
+
*
|
|
70
|
+
* Both sets judge every line, and the language of the file is not determined: a Russian pattern
|
|
71
|
+
* does not match on an English line, nor an English one on a Russian line, and determining the
|
|
72
|
+
* language by the directory or by the letters would add branching for nothing. The word boundary is
|
|
73
|
+
* a Latin letter, for the same reason as the Cyrillic one above: `\b` behaves in its own way with
|
|
74
|
+
* an apostrophe and a hyphen.
|
|
75
|
+
*/
|
|
76
|
+
const MARKS_EN = [
|
|
77
|
+
[/(?<![A-Za-z])in order to(?![A-Za-z])/giu, '«to»'],
|
|
78
|
+
[/(?<![A-Za-z])for the purpose of(?![A-Za-z])/giu, '«to», «for»'],
|
|
79
|
+
[/(?<![A-Za-z])in the event that(?![A-Za-z])/giu, '«if»'],
|
|
80
|
+
[/(?<![A-Za-z])due to the fact that(?![A-Za-z])/giu, '«because»'],
|
|
81
|
+
[/(?<![A-Za-z])at this point in time(?![A-Za-z])/giu, '«now»'],
|
|
82
|
+
[/(?<![A-Za-z])prior to(?![A-Za-z])/giu, '«before»'],
|
|
83
|
+
[/(?<![A-Za-z])subsequent to(?![A-Za-z])/giu, '«after»'],
|
|
84
|
+
[/(?<![A-Za-z])with regard to(?![A-Za-z])/giu, '«about», «on»'],
|
|
85
|
+
[/(?<![A-Za-z])in terms of(?![A-Za-z])/giu, 'name the relation directly'],
|
|
86
|
+
[/(?<![A-Za-z])utili[sz](e|es|ed|ing|ation)(?![A-Za-z])/giu, '«use»'],
|
|
87
|
+
[/(?<![A-Za-z])leverag(e|es|ed|ing)(?![A-Za-z])/giu, '«use»'],
|
|
88
|
+
[/(?<![A-Za-z])facilitat(e|es|ed|ing)(?![A-Za-z])/giu, 'name the action itself: «helps», «lets», «runs»'],
|
|
89
|
+
[/(?<![A-Za-z])(is|are|was|were) able to(?![A-Za-z])/giu, '«can», «could»'],
|
|
90
|
+
[/(?<![A-Za-z])(has|have|had) the ability to(?![A-Za-z])/giu, '«can», «could»'],
|
|
91
|
+
[/(?<![A-Za-z])it should be noted that(?![A-Za-z])/giu, 'drop it: if it is worth noting, note it'],
|
|
92
|
+
[/(?<![A-Za-z])it is (important|worth) (to note|noting) that(?![A-Za-z])/giu, 'drop it: say the thing'],
|
|
93
|
+
[/(?<![A-Za-z])as (previously|already) (mentioned|stated|noted)(?![A-Za-z])/giu, 'drop it: said twice is not truer'],
|
|
94
|
+
[/(?<![A-Za-z])the aforementioned(?![A-Za-z])/giu, 'name it again'],
|
|
95
|
+
[/(?<![A-Za-z])in a timely manner(?![A-Za-z])/giu, '«on time», «promptly»'],
|
|
96
|
+
[/(?<![A-Za-z])a number of(?![A-Za-z])/giu, '«some», «several», or the number'],
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
/** The words of the left column of the glossary: they are neither written nor said anywhere. */
|
|
54
100
|
const GLOSSARY_BANS = [
|
|
55
101
|
[/(?<![а-яёА-ЯЁ])таск[аиуе](?![а-яёА-ЯЁ])/giu, 'задача'],
|
|
56
102
|
[/(?<![а-яёА-ЯЁ])тикет[а-яё]*(?![а-яёА-ЯЁ])/giu, 'задача'],
|
|
@@ -62,58 +108,104 @@ const GLOSSARY_BANS = [
|
|
|
62
108
|
[/(?<![а-яёА-ЯЁ])скилл[а-яё]*(?![а-яёА-ЯЁ])/giu, 'правило, паттерн или скил без закона'],
|
|
63
109
|
];
|
|
64
110
|
|
|
111
|
+
/**
|
|
112
|
+
* The tree's words beyond the package ones: they are read from the check settings and fall into the
|
|
113
|
+
* same set.
|
|
114
|
+
*
|
|
115
|
+
* A tree writes its own half of the "Not written here" table by a glossary override, and without
|
|
116
|
+
* this nothing judged that half: the set was hard-coded. A tree used to start a check of its own
|
|
117
|
+
* alongside — a second set of patterns for one requirement, and they could diverge silently.
|
|
118
|
+
*/
|
|
119
|
+
const TREE_BANS = (CONFIG.prose?.glossaryBans ?? [])
|
|
120
|
+
.filter((one) => one && typeof one.pattern === 'string' && typeof one.fix === 'string')
|
|
121
|
+
.map((one) => {
|
|
122
|
+
try {
|
|
123
|
+
return [new RegExp(one.pattern, 'giu'), one.fix];
|
|
124
|
+
} catch {
|
|
125
|
+
// An unfit pattern does not drop the whole check: the rest of the words are judged as before.
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
.filter(Boolean);
|
|
130
|
+
|
|
65
131
|
const CODE_FENCE = /^\s*```/;
|
|
66
132
|
|
|
67
133
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
134
|
+
* Headings that match a pattern of officialese but are not prose: these are the names of the
|
|
135
|
+
* mandatory spec sections, and the section set requires them word for word.
|
|
70
136
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
137
|
+
* They are listed by name rather than lifted by a rule: the word «данные» in a sentence does not
|
|
138
|
+
* stop being officialese — «данные требования» is still caught. Without this exception no new spec
|
|
139
|
+
* could be written at all: the section set requires the heading, and the style check refuses it,
|
|
140
|
+
* and both requirements are right each in its own way.
|
|
75
141
|
*/
|
|
76
142
|
const HEADING_EXCEPTIONS = new Set(['Данные']);
|
|
77
143
|
|
|
78
|
-
/**
|
|
144
|
+
/** A heading whose name is named as an exception: there is nothing to judge in it — it is a section name, not a phrase. */
|
|
79
145
|
function isExemptHeading(line) {
|
|
80
146
|
const heading = line.match(/^\s*#{1,6}\s+(.+?)\s*$/);
|
|
81
147
|
|
|
82
148
|
return heading !== null && HEADING_EXCEPTIONS.has(heading[1]);
|
|
83
149
|
}
|
|
84
150
|
|
|
85
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* A quotation of a law: a quote block introduced by a line with the address of a law.
|
|
153
|
+
*
|
|
154
|
+
* The words the check refuses stand in the laws themselves by the dozen. Having quoted an article
|
|
155
|
+
* word for word, the work runs into a refusal: fix the quotation and you lie, leave it and you
|
|
156
|
+
* cannot push. So only one's own writing is judged, and someone else's text in a quotation stays as
|
|
157
|
+
* it is.
|
|
158
|
+
*
|
|
159
|
+
* The sign is deliberately narrow: not any quotation, but one introduced by the address of a law.
|
|
160
|
+
* Otherwise a quote block would become the place where one's own writing is hidden from the check.
|
|
161
|
+
*/
|
|
162
|
+
const LAW_ADDRESS = /docs\/constitution\/[A-Za-z0-9_./-]+\.md/;
|
|
163
|
+
const QUOTE = /^\s*>/;
|
|
164
|
+
|
|
165
|
+
/** Lines outside code blocks and outside quotations of laws: someone else's words lie there, and style is not judged there. */
|
|
86
166
|
function proseLines(text) {
|
|
87
167
|
const out = [];
|
|
88
168
|
let inFence = false;
|
|
169
|
+
let introducesLaw = false;
|
|
170
|
+
let inLawQuote = false;
|
|
89
171
|
text.split('\n').forEach((line, index) => {
|
|
90
172
|
if (CODE_FENCE.test(line)) {
|
|
91
173
|
inFence = !inFence;
|
|
92
174
|
return;
|
|
93
175
|
}
|
|
94
176
|
if (inFence) return;
|
|
177
|
+
|
|
178
|
+
if (QUOTE.test(line)) {
|
|
179
|
+
if (!inLawQuote && (introducesLaw || LAW_ADDRESS.test(line))) inLawQuote = true;
|
|
180
|
+
if (inLawQuote) return;
|
|
181
|
+
} else {
|
|
182
|
+
inLawQuote = false;
|
|
183
|
+
// The line that introduces a quotation is the one before it that names the address of a law.
|
|
184
|
+
if (line.trim() !== '') introducesLaw = LAW_ADDRESS.test(line);
|
|
185
|
+
}
|
|
186
|
+
|
|
95
187
|
if (isExemptHeading(line)) return;
|
|
96
188
|
out.push([index + 1, line]);
|
|
97
189
|
});
|
|
98
190
|
return out;
|
|
99
191
|
}
|
|
100
192
|
|
|
101
|
-
/**
|
|
193
|
+
/** The findings of one line: the pattern, what was found, what to replace it with. */
|
|
102
194
|
function findingsIn(line) {
|
|
103
195
|
const found = [];
|
|
104
|
-
[...MARKS, ...GLOSSARY_BANS].forEach(([re, fix]) => {
|
|
196
|
+
[...MARKS, ...MARKS_EN, ...GLOSSARY_BANS, ...TREE_BANS].forEach(([re, fix]) => {
|
|
105
197
|
const hit = line.match(re);
|
|
106
198
|
if (hit) found.push([hit[0], fix]);
|
|
107
199
|
});
|
|
108
200
|
return found;
|
|
109
201
|
}
|
|
110
202
|
|
|
111
|
-
/**
|
|
203
|
+
/** A sentence that is too long: the reader loses the beginning before the author reaches the end. */
|
|
112
204
|
function longSentences(line) {
|
|
113
205
|
return line
|
|
114
206
|
.split(/(?<=[.!?])\s+/)
|
|
115
207
|
.filter((sentence) => sentence.trim().split(/\s+/).length > WORDS_LIMIT)
|
|
116
|
-
.map((sentence) => [`${sentence.trim().split(/\s+/).length}
|
|
208
|
+
.map((sentence) => [`${sentence.trim().split(/\s+/).length} words in a sentence`, `split it: the limit is ${WORDS_LIMIT}`]);
|
|
117
209
|
}
|
|
118
210
|
|
|
119
211
|
export function checkProse(text) {
|
|
@@ -128,10 +220,10 @@ if (files.length > 0) {
|
|
|
128
220
|
checkProse(readFileSync(file, 'utf8')).map((p) => ` ${file}:${p.line} — «${p.what}» → ${p.fix}`)
|
|
129
221
|
);
|
|
130
222
|
if (problems.length > 0) {
|
|
131
|
-
console.error(`check-prose-style:
|
|
223
|
+
console.error(`check-prose-style: findings ${problems.length}\n`);
|
|
132
224
|
problems.forEach((p) => console.error(p));
|
|
133
|
-
console.error('\
|
|
225
|
+
console.error('\nWording is the rule about texts. The check sees the listed signs and only them.');
|
|
134
226
|
process.exit(1);
|
|
135
227
|
}
|
|
136
|
-
console.log(`check-prose-style:
|
|
228
|
+
console.log(`check-prose-style: files checked ${files.length}, no findings`);
|
|
137
229
|
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The check that the set of the push gate is not narrower than the set of the pipeline.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* The push gate is a promise that the push will not arrive red. While its set is narrower than the
|
|
6
|
+
* set of the pipeline, the promise is wider than what the gate checks, and it is wrong silently:
|
|
7
|
+
* neither the gate nor its output says what is missing from it. Twice in a row an edit that passed
|
|
8
|
+
* the gate whole was refused by the pipeline — and both times the green gate was read as
|
|
9
|
+
* «everything is green locally».
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* The pipeline file is not interpreted by a machine: the commands there are arbitrary, and part of
|
|
12
|
+
* the steps cannot be run locally at all — the cache, uploading traces, signing in to the registry.
|
|
13
|
+
* Only the NAMES of the steps are taken from there, and what each of them is closed by in the gate
|
|
14
|
+
* is declared by the tree. An undeclared name turns red: the hole is seen on the spot and is not
|
|
15
|
+
* deduced by comparing two lists with the eyes.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* выглядят одинаково, пока номер никто не спросил.
|
|
17
|
+
* A declaration comes in two kinds. A line is the very command the `rt_push_checks` of the profile
|
|
18
|
+
* prints; it is checked against its output, because a declaration without a run is the same hole.
|
|
19
|
+
* An exception is the reason why the step is not in the gate; an empty reason does not count as an
|
|
20
|
+
* exception: it is the only thing by which a permanent hole differs from a forgotten line. A reason
|
|
21
|
+
* naming a task is judged on the liveness of that task as well: a deferral with a deadline and a
|
|
22
|
+
* deferral without one look alike while nobody has asked about the number.
|
|
24
23
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* A tree without a pipeline file gets no comparison: a check falling where there is no pipeline
|
|
25
|
+
* would refuse the work instead of a miss.
|
|
27
26
|
*
|
|
28
|
-
*
|
|
27
|
+
* A non-zero exit code and the list of discrepancies.
|
|
29
28
|
*/
|
|
30
29
|
import { execFileSync } from 'node:child_process';
|
|
31
30
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -36,23 +35,25 @@ import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
|
36
35
|
const GATE = CONFIG.pushGate ?? {};
|
|
37
36
|
const PIPELINE = GATE.pipelineFile ?? '';
|
|
38
37
|
const DECLARED = GATE.steps ?? {};
|
|
39
|
-
/**
|
|
38
|
+
/** The task key of the tree: by it a number in a reason differs from a version, a port and a year. */
|
|
40
39
|
const TASK_KEY = CONFIG.board?.taskKey ?? '';
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* The profile of the tree is looked for by the same chain as at the push guard: the package
|
|
43
|
+
* default, and the override of the project on top of it. Were they to diverge, the check would
|
|
44
|
+
* judge a set other than the one the guard runs.
|
|
45
45
|
*/
|
|
46
46
|
const PROFILES = ['.claude/rt-kit/defaults/project.sh', '.claude/rt-kit/project.sh'];
|
|
47
47
|
|
|
48
48
|
if (!PIPELINE || !existsSync(join(ROOT, PIPELINE))) {
|
|
49
|
-
console.log('check-push-gate:
|
|
49
|
+
console.log('check-push-gate: skipped — the tree has no pipeline file');
|
|
50
50
|
process.exit(0);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
54
|
+
* The names of the pipeline steps. The template is set by the tree: every hosting has its own form
|
|
55
|
+
* of writing, and the package does not undertake to guess it for all three. The default is the
|
|
56
|
+
* GitHub Actions form.
|
|
56
57
|
*/
|
|
57
58
|
const stepPattern = new RegExp(GATE.stepPattern ?? '^\\s*-\\s*name:\\s*(.+?)\\s*$');
|
|
58
59
|
|
|
@@ -65,11 +66,12 @@ function pipelineSteps() {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
69
|
+
* The set of the gate is taken from the profile by its own shell, not rewritten here: two lists of
|
|
70
|
+
* one set diverge silently, and they start diverging the day one of them is edited.
|
|
70
71
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
72
|
+
* There is no profile, no function in it, or the shell refused — the set is unknown, and then the
|
|
73
|
+
* check judges only the completeness of the declarations: there is nothing to compare the lines
|
|
74
|
+
* against.
|
|
73
75
|
*/
|
|
74
76
|
function gateChecks() {
|
|
75
77
|
const present = PROFILES.filter((path) => existsSync(join(ROOT, path)));
|
|
@@ -90,8 +92,9 @@ rt_push_checks ""`;
|
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
+
* The task numbers named by a reason. The key of the tree is mandatory: without it «663» is
|
|
96
|
+
* indistinguishable from a port, a year and an edition number, and the check would ask the work
|
|
97
|
+
* queue about everything in a row.
|
|
95
98
|
*/
|
|
96
99
|
function taskNumbers(reason) {
|
|
97
100
|
if (!TASK_KEY) {
|
|
@@ -101,9 +104,9 @@ function taskNumbers(reason) {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
+
* The work queue is looked for by module resolution, not assembled here: every hosting has its own,
|
|
108
|
+
* and a tree that has none is judged as before. The tier is the same as at the delivery guard:
|
|
109
|
+
* there is something to ask with — it asks, there is not — it stays silent.
|
|
107
110
|
*/
|
|
108
111
|
async function boardModule() {
|
|
109
112
|
if (!TASK_KEY) {
|
|
@@ -120,7 +123,7 @@ async function boardModule() {
|
|
|
120
123
|
const steps = pipelineSteps();
|
|
121
124
|
const checks = gateChecks();
|
|
122
125
|
const problems = [];
|
|
123
|
-
/**
|
|
126
|
+
/** The tasks named by the reasons of exceptions: asked in one batch after all the steps are read. */
|
|
124
127
|
const deferrals = [];
|
|
125
128
|
|
|
126
129
|
for (const step of steps) {
|
|
@@ -128,7 +131,7 @@ for (const step of steps) {
|
|
|
128
131
|
|
|
129
132
|
if (declaration === undefined) {
|
|
130
133
|
problems.push(
|
|
131
|
-
|
|
134
|
+
`the pipeline step «${step}» is not declared: close it by a line of the set in pushGate.steps ` + 'or declare it an exclusion with a reason'
|
|
132
135
|
);
|
|
133
136
|
continue;
|
|
134
137
|
}
|
|
@@ -136,7 +139,7 @@ for (const step of steps) {
|
|
|
136
139
|
if (typeof declaration === 'object' && declaration !== null) {
|
|
137
140
|
const reason = String(declaration.skip ?? '').trim();
|
|
138
141
|
if (!reason) {
|
|
139
|
-
problems.push(
|
|
142
|
+
problems.push(`the pipeline step «${step}» is declared an exclusion without a reason — an empty reason does not count`);
|
|
140
143
|
continue;
|
|
141
144
|
}
|
|
142
145
|
for (const number of taskNumbers(reason)) {
|
|
@@ -147,27 +150,27 @@ for (const step of steps) {
|
|
|
147
150
|
|
|
148
151
|
const line = String(declaration).trim();
|
|
149
152
|
if (!line) {
|
|
150
|
-
problems.push(
|
|
153
|
+
problems.push(`the pipeline step «${step}» is declared by an empty line — name the command or declare an exclusion`);
|
|
151
154
|
continue;
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
if (checks && !checks.some((check) => check.includes(line))) {
|
|
155
|
-
problems.push(
|
|
158
|
+
problems.push(`the pipeline step «${step}» is declared by the line «${line}», and the gate set does not print it`);
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
/**
|
|
162
|
+
/** A line about a step the pipeline does not have is stale: otherwise declarations pile up the dead. */
|
|
160
163
|
const known = new Set(steps);
|
|
161
164
|
for (const step of Object.keys(DECLARED)) {
|
|
162
165
|
if (!known.has(step)) {
|
|
163
|
-
problems.push(
|
|
166
|
+
problems.push(`the declaration «${step}» is stale — there is no such step in ${PIPELINE}`);
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
+
* A dead number in a reason makes the exception open-ended without saying so by a single line. The
|
|
172
|
+
* very first refusal of the network ends the whole polling: there is no point asking the rest, and
|
|
173
|
+
* still less point in falling for a check that is run on a plane.
|
|
171
174
|
*/
|
|
172
175
|
const board = deferrals.length > 0 ? await boardModule() : null;
|
|
173
176
|
if (board) {
|
|
@@ -179,19 +182,19 @@ if (board) {
|
|
|
179
182
|
break;
|
|
180
183
|
}
|
|
181
184
|
if (state && state.exists === false) {
|
|
182
|
-
problems.push(
|
|
185
|
+
problems.push(`the pipeline step «${step}» is postponed until the task ${TASK_KEY}-${number}, and there is no such task in the work queue — the postponement is perpetual`);
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
if (problems.length > 0) {
|
|
188
|
-
console.error(`check-push-gate:
|
|
191
|
+
console.error(`check-push-gate: divergences ${problems.length}\n`);
|
|
189
192
|
problems.forEach((problem) => console.error(` ${problem}`));
|
|
190
|
-
console.error('\
|
|
193
|
+
console.error('\nThe push gate set is never narrower than the pipeline set — the rule of delivery.');
|
|
191
194
|
process.exit(1);
|
|
192
195
|
}
|
|
193
196
|
|
|
194
197
|
const skipped = Object.values(DECLARED).filter((value) => typeof value === 'object' && value !== null).length;
|
|
195
198
|
console.log(
|
|
196
|
-
`check-push-gate:
|
|
199
|
+
`check-push-gate: pipeline steps ${steps.length}, closed by the set ${steps.length - skipped}, ` + `declared as exclusions ${skipped}`
|
|
197
200
|
);
|