@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,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* What is shared by every subject of the spec audit: what counts as a domain, how the tree is
|
|
3
|
+
* read and how a document is cut into sections and bullets.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The module is not named `check-*`, and that is not decoration: the package default assembles the
|
|
6
|
+
* push gate set by walking the names `check-<what>.mjs` in the checks directory, and a helper with
|
|
7
|
+
* such a name the gate would run as a check of its own.
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
@@ -14,103 +14,136 @@ import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
|
14
14
|
const SPECS_DIR = CONFIG.specsDir;
|
|
15
15
|
const CONSTITUTION_DIR = 'docs/constitution';
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Directories under `docs/specs` that are not domains: the template holds samples with
|
|
18
|
+
* placeholders, and it has no mandatory sections.
|
|
19
19
|
*/
|
|
20
20
|
const NOT_DOMAINS = ['_template'];
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Where tests are searched for. Taken from the setting of the tree, not from the code: roots
|
|
23
|
+
* hardwired here silently found no test at all in a tree that keeps its code differently — and
|
|
24
|
+
* every scenario looked uncovered while the test for it stood right there.
|
|
25
|
+
*
|
|
26
|
+
* Two lists, not one: the suites of a tree's own checks lie next to the tooling, outside the
|
|
27
|
+
* source roots, and a suite lying there was invisible while the roots were read from one setting.
|
|
28
|
+
* What came of that is indistinguishable from a real hole — the scenario stands as uncovered, the
|
|
29
|
+
* suite is written and green, and the list of the uncovered stops meaning anything.
|
|
30
|
+
*
|
|
31
|
+
* A root lying inside another named root is dropped: otherwise a tree that named both a source
|
|
32
|
+
* root and a suite directory inside it gets every reference twice.
|
|
25
33
|
*/
|
|
26
|
-
const TEST_ROOTS = CONFIG.sourceRoots
|
|
27
|
-
|
|
34
|
+
const TEST_ROOTS = [...new Set([...CONFIG.sourceRoots, ...CONFIG.testRoots])].filter(
|
|
35
|
+
(root, _index, roots) => !roots.some((other) => other !== root && root.startsWith(`${other}/`))
|
|
36
|
+
);
|
|
37
|
+
/** Where the call of a symbol from a binding is searched for. */
|
|
28
38
|
const SOURCE_ROOTS = [...CONFIG.sourceRoots, ...(CONFIG.schemaFile ? [CONFIG.schemaFile.split('/')[0]] : [])];
|
|
29
39
|
const SKIPPED_DIRS = CONFIG.skippedDirs;
|
|
30
40
|
|
|
31
41
|
/**
|
|
32
|
-
* `### SC-BK-03 —
|
|
42
|
+
* `### SC-BK-03 — a request for dates already taken`
|
|
33
43
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
44
|
+
* The number is accepted from one digit to three. A heading that did not match the template starts
|
|
45
|
+
* no scenario and gives no refusal: a tree that numbered its scenarios from one would lose the
|
|
46
|
+
* first nine of them silently — neither in coverage nor in debts, with a green audit.
|
|
37
47
|
*/
|
|
38
48
|
const SCENARIO_HEADING = /^###\s+(SC-([A-Z]{2,4})-(\d{1,3}))\s+—\s+(.+?)\s*$/;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The keys of a spec are read under two names, English and the owner's. A tree translates its
|
|
51
|
+
* specs one domain at a time, and a key that moved instead of learning the second name takes the
|
|
52
|
+
* untranslated domains out of the audit silently: the heading is not found, the statements and the
|
|
53
|
+
* scenarios are not read, and the audit stays green about a domain it no longer sees.
|
|
54
|
+
*/
|
|
55
|
+
/** The mark of a knowingly uncovered scenario; the reason is mandatory */
|
|
56
|
+
const UNCOVERED = /^(?:Not covered|Не покрыто):\s*\S/;
|
|
57
|
+
/** The test exists, but checks not everything promised or goes another way */
|
|
58
|
+
const PARTIAL = /^(?:Coverage:\s*partial|Покрытие:\s*частичное)\s*—\s*\S/;
|
|
59
|
+
/** A mention of the scenario in the title of a test; the number is as long as in the heading */
|
|
44
60
|
const SCENARIO_REFERENCE = /\bSC-[A-Z]{2,4}-\d{1,3}\b/g;
|
|
45
|
-
/**
|
|
46
|
-
const PROMISE =
|
|
61
|
+
/** The promise line of a scenario; its continuations go with an indent */
|
|
62
|
+
const PROMISE = /^(?:Then|Тогда)\s+\S/;
|
|
47
63
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
64
|
+
* A person in front of the screen and their perception. Word boundaries are not set: `\b` in
|
|
65
|
+
* JavaScript counts only Latin letters as letters, and `\bгость\b` would not match once.
|
|
50
66
|
*/
|
|
51
|
-
const ACTOR = /(гост[ьяию]|владел(?:ец|ьца|ьцу|ьцем)|сотрудник\w*|оператор\w*|пользовател\w
|
|
52
|
-
const PERCEIVES = /(вид(?:ит|ят|но)|чита(?:ет|ют)|смотр(?:ит|ят))/i;
|
|
53
|
-
/**
|
|
67
|
+
const ACTOR = /(гост[ьяию]|владел(?:ец|ьца|ьцу|ьцем)|сотрудник\w*|оператор\w*|пользовател\w+|\bguests?\b|\bowner\b|\bemployees?\b|\boperators?\b|\busers?\b)/i;
|
|
68
|
+
const PERCEIVES = /(вид(?:ит|ят|но)|чита(?:ет|ют)|смотр(?:ит|ят)|\bsees?\b|\breads?\b|\bis shown\b|\bare shown\b)/i;
|
|
69
|
+
/** End-to-end tests: only they go the same way the user does */
|
|
54
70
|
const E2E_ROOTS = CONFIG.e2eRoots;
|
|
55
71
|
|
|
56
72
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
73
|
+
* The anchor of a rule: `path/to/file.ts:symbol` in backticks. The extension goes up to eight
|
|
74
|
+
* letters — otherwise `schema.prisma` does not count as a path, and the rule about the default of
|
|
75
|
+
* a column looks like a rule without an anchor. Capitals and ten letters are needed for
|
|
76
|
+
* `api.Dockerfile`: without them the rule about the run mode of the image counted as a rule with
|
|
77
|
+
* an empty binding, and there is nothing else left to bind it to — the mode is declared exactly
|
|
78
|
+
* there.
|
|
62
79
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
80
|
+
* The symbol is any letter, not only a Latin one: the texts a model executes are written in their
|
|
81
|
+
* own language, and Latin in them names exactly what holds no statement — the name of a header
|
|
82
|
+
* field, the name of a tool. A statement bound to the name of a field stays green when the text is
|
|
83
|
+
* rewritten whole. The alphabet is not listed by ranges: the listed ones silently do not cover the
|
|
84
|
+
* neighbouring one, and the miss looks like an absent binding. The path stays Latin all the same —
|
|
85
|
+
* it is an address in the tree, not a word of the text.
|
|
69
86
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
87
|
+
* A hash before the name is lawful: a private field of a class is declared with it, and the name
|
|
88
|
+
* written without it calls the method by a name it was not declared with. The check stays green
|
|
89
|
+
* meanwhile — there is a word boundary before the hash — so the miss never turns red and is seen
|
|
90
|
+
* only by reading.
|
|
73
91
|
*/
|
|
74
|
-
|
|
92
|
+
// The symbol of a binding is also a line number or a class name with a dot in front: in markup
|
|
93
|
+
// there is nothing else to bind to — an element has neither a method nor a field. Before, such a
|
|
94
|
+
// binding did not match the template, and the audit said there was no binding at all; a session
|
|
95
|
+
// went on rewriting a table of bindings that was right.
|
|
96
|
+
const ANCHOR = /`([\w./-]+\.[A-Za-z]{2,10}):(#?\p{L}[\p{L}\p{N}_-]*|#?_[\w-]*|\d+|\.[\p{L}\p{N}_-]+)`/gu;
|
|
75
97
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
98
|
+
* An explicit verdict instead of an anchor: an article that has nowhere to be carried out in the
|
|
99
|
+
* tree. That happens lawfully — the rule speaks of a service the tree does not keep, or of a human
|
|
100
|
+
* movement the check cannot reach: the merge button is pressed in the browser, where there are no
|
|
101
|
+
* hooks at all. An anchor for such an article can only be put into a file that does not carry it
|
|
102
|
+
* out — the check would accept it, and the reader would be lied to.
|
|
103
|
+
*
|
|
104
|
+
* A verdict with a reason is accepted, not a single word: an empty one becomes a way to close any
|
|
105
|
+
* line, and in a month the table turns into a list of excuses. The length threshold is the same
|
|
106
|
+
* measure as the bypass of the document guard: a reason shorter than that does not count as a
|
|
107
|
+
* reason.
|
|
81
108
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
109
|
+
* The end of the word is found by a negative lookahead, not by `\b`: JavaScript knows only Latin
|
|
110
|
+
* as a word boundary, and after a Cyrillic letter there is none at all — the verdict was not
|
|
111
|
+
* recognised once.
|
|
85
112
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* разу.
|
|
113
|
+
* The verdict has two names: an English one in a companion written after the layer was translated,
|
|
114
|
+
* a Russian one in a companion written before it. Either is enough.
|
|
89
115
|
*/
|
|
90
|
-
const VERDICT =
|
|
116
|
+
const VERDICT =
|
|
117
|
+
/^\s*(?:\*\*)?(?:Not (?:carried out|applicable|checked)|Не (?:исполняется|применимо|проверяется))(?![\p{L}\p{N}_])/u;
|
|
91
118
|
const VERDICT_MIN = 40;
|
|
92
|
-
/**
|
|
93
|
-
const PROCEDURE_ROOTS =
|
|
119
|
+
/** The header line declaring the libs whose procedures the domain serves */
|
|
120
|
+
const PROCEDURE_ROOTS = /^\*\*(?:Procedures|Процедуры):\*\*\s*(.+)$/;
|
|
94
121
|
const BACKTICKED = /`([^`]+)`/g;
|
|
95
122
|
|
|
123
|
+
/**
|
|
124
|
+
* The mandatory sections of a spec, each under two names: the English one first, the owner's
|
|
125
|
+
* second. A spec carries one of the two, and a tree translating its specs domain by domain keeps a
|
|
126
|
+
* green audit all the while. The refusal names the first of the pair — the one a new spec is
|
|
127
|
+
* written by.
|
|
128
|
+
*/
|
|
96
129
|
const REQUIRED_HEADINGS = [
|
|
97
|
-
'## Зачем',
|
|
98
|
-
'## Терминология',
|
|
99
|
-
'### Как это называется в интерфейсе',
|
|
100
|
-
'## Правила',
|
|
101
|
-
'## Что не входит',
|
|
102
|
-
'## Контракт',
|
|
103
|
-
'### Коды отказов',
|
|
104
|
-
'## Данные',
|
|
105
|
-
'## Экраны и состояния',
|
|
106
|
-
'## Сквозные требования',
|
|
107
|
-
'### Локали',
|
|
108
|
-
'### SEO',
|
|
109
|
-
'### Мобильная раскладка',
|
|
110
|
-
'### Мультиобъектность',
|
|
111
|
-
'## Решения',
|
|
112
|
-
'## Открытые вопросы',
|
|
113
|
-
'## История изменений',
|
|
130
|
+
['## Why', '## Зачем'],
|
|
131
|
+
['## Terminology', '## Терминология'],
|
|
132
|
+
['### What it is called in the interface', '### Как это называется в интерфейсе'],
|
|
133
|
+
['## Rules', '## Правила'],
|
|
134
|
+
['## What is out of scope', '## Что не входит'],
|
|
135
|
+
['## Contract', '## Контракт'],
|
|
136
|
+
['### Refusal codes', '### Коды отказов'],
|
|
137
|
+
['## Data', '## Данные'],
|
|
138
|
+
['## Screens and states', '## Экраны и состояния'],
|
|
139
|
+
['## Cross-cutting requirements', '## Сквозные требования'],
|
|
140
|
+
['### Locales', '### Локали'],
|
|
141
|
+
['### SEO'],
|
|
142
|
+
['### Mobile layout', '### Мобильная раскладка'],
|
|
143
|
+
['### Several objects', '### Мультиобъектность'],
|
|
144
|
+
['## Decisions', '## Решения'],
|
|
145
|
+
['## Open questions', '## Открытые вопросы'],
|
|
146
|
+
['## History of changes', '## История изменений'],
|
|
114
147
|
];
|
|
115
148
|
|
|
116
149
|
const problems = [];
|
|
@@ -142,7 +175,7 @@ function walk(dir, accept) {
|
|
|
142
175
|
const read = (path) => readFileSync(join(ROOT, path), 'utf8');
|
|
143
176
|
const exists = (path) => existsSync(join(ROOT, path));
|
|
144
177
|
|
|
145
|
-
/**
|
|
178
|
+
/** The directories of domains: `docs/specs/<domain>`, except the template. */
|
|
146
179
|
function collectDomains() {
|
|
147
180
|
try {
|
|
148
181
|
return readdirSync(join(ROOT, SPECS_DIR), { withFileTypes: true })
|
|
@@ -154,14 +187,17 @@ function collectDomains() {
|
|
|
154
187
|
}
|
|
155
188
|
|
|
156
189
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
190
|
+
* The lines of a section: from its heading to the next heading of the same or a higher level.
|
|
191
|
+
* Subsections belong to the section — the refusal codes are taken apart separately, but stay part
|
|
192
|
+
* of the contract.
|
|
160
193
|
*/
|
|
161
194
|
function sectionOf(text, heading) {
|
|
162
|
-
|
|
195
|
+
// The heading arrives as one name or as a list of names: a spec carries the English heading or
|
|
196
|
+
// the owner's one, and the section is the same section under either.
|
|
197
|
+
const names = Array.isArray(heading) ? heading : [heading];
|
|
198
|
+
const level = names[0].match(/^#+/)[0].length;
|
|
163
199
|
const lines = text.split('\n');
|
|
164
|
-
const start = lines.findIndex((line) => line.trimEnd()
|
|
200
|
+
const start = lines.findIndex((line) => names.includes(line.trimEnd()));
|
|
165
201
|
if (start < 0) {
|
|
166
202
|
return [];
|
|
167
203
|
}
|
|
@@ -175,7 +211,15 @@ function sectionOf(text, heading) {
|
|
|
175
211
|
return end < 0 ? rest : rest.slice(0, end);
|
|
176
212
|
}
|
|
177
213
|
|
|
178
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* The bullets of a top-level list together with their continuations.
|
|
216
|
+
*
|
|
217
|
+
* A heading inside the section does not end the list: the section is already cut by the level of
|
|
218
|
+
* its heading, and a `#` line in it is always deeper — a subheading by which the spec of a large
|
|
219
|
+
* domain groups its rules. A table ends the list as before; the line it ended on is handed over in
|
|
220
|
+
* the `stoppedAt` property, so that the refusal about an empty section names what stands in it
|
|
221
|
+
* instead of bullets.
|
|
222
|
+
*/
|
|
179
223
|
function bulletsOf(lines) {
|
|
180
224
|
const bullets = [];
|
|
181
225
|
for (const [index, line] of lines.entries()) {
|
|
@@ -183,10 +227,10 @@ function bulletsOf(lines) {
|
|
|
183
227
|
bullets.push({ line: index, text: line });
|
|
184
228
|
} else if (bullets.length && /^\s+\S/.test(line)) {
|
|
185
229
|
bullets[bullets.length - 1].text += ` ${line.trim()}`;
|
|
186
|
-
} else if (!line.trim()) {
|
|
230
|
+
} else if (!line.trim() || /^#/.test(line)) {
|
|
187
231
|
continue;
|
|
188
|
-
} else if (
|
|
189
|
-
|
|
232
|
+
} else if (/^\|/.test(line)) {
|
|
233
|
+
bullets.stoppedAt = line;
|
|
190
234
|
break;
|
|
191
235
|
}
|
|
192
236
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The spec contract against what the code declares: the procedure table against the decorators,
|
|
3
|
+
* the refusal codes against the throw points.
|
|
4
4
|
*/
|
|
5
5
|
import { BACKTICKED, PROCEDURE_ROOTS, bulletsOf, read, report, sectionOf, walk } from './spec-common.mjs';
|
|
6
6
|
|
|
7
|
-
// ── 2.
|
|
7
|
+
// ── 2. The contract against the decorators ────────────────────────────────────
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/** The lib roots whose procedures the domain serves; declared in the spec header. */
|
|
10
10
|
function procedureRootsOf(text) {
|
|
11
11
|
const line = text.split('\n').find((candidate) => PROCEDURE_ROOTS.test(candidate));
|
|
12
12
|
if (!line) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
const value = line.match(PROCEDURE_ROOTS)[1];
|
|
16
|
-
if (/^\s
|
|
16
|
+
if (/^\s*(?:none|нет)\s*$/i.test(value.replace(/[`.]/g, ''))) {
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return [...value.matchAll(BACKTICKED)].map(([, path]) => path);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/** What the procedures themselves declare: the contract method and the right to it. */
|
|
24
24
|
function declaredProcedures(roots) {
|
|
25
25
|
const found = new Map();
|
|
26
26
|
for (const root of roots) {
|
|
@@ -45,10 +45,10 @@ function declaredProcedures(roots) {
|
|
|
45
45
|
return found;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/**
|
|
48
|
+
/** Rows of the "Contract" table: the first cell is the procedure, the second is the right. */
|
|
49
49
|
function contractRows(text) {
|
|
50
50
|
const rows = [];
|
|
51
|
-
for (const [index, line] of sectionOf(text, '## Контракт').entries()) {
|
|
51
|
+
for (const [index, line] of sectionOf(text, ['## Contract', '## Контракт']).entries()) {
|
|
52
52
|
if (!line.startsWith('|') || /^\|[\s:|-]+\|$/.test(line)) {
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
@@ -64,12 +64,12 @@ function contractRows(text) {
|
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
66
|
const permission = (cells[1].match(/`([^`]+)`/) || [])[1] || cells[1];
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
67
|
+
// A row with a refusal code in the second cell does not count as a procedure. The
|
|
68
|
+
// "Contract" section holds two different tables: the list of procedures with rights and
|
|
69
|
+
// the list of refusal codes with reasons — and by the shape of a row they are
|
|
70
|
+
// indistinguishable, both carry a value in backticks in the first cell. While the parse
|
|
71
|
+
// took any of them, a spec with declared procedures got its own table of codes read as a
|
|
72
|
+
// list of procedures: every row of it became a procedure the domain does not have.
|
|
73
73
|
if (/^\d{3}$/.test(permission.trim())) {
|
|
74
74
|
continue;
|
|
75
75
|
}
|
|
@@ -81,7 +81,7 @@ function contractRows(text) {
|
|
|
81
81
|
|
|
82
82
|
function checkContract(file, text, roots) {
|
|
83
83
|
if (roots === null) {
|
|
84
|
-
report(file, '
|
|
84
|
+
report(file, 'the header carries no line `**Процедуры:**` — there is nothing to check the table of «Контракт» against the decorators with');
|
|
85
85
|
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
@@ -92,14 +92,14 @@ function checkContract(file, text, roots) {
|
|
|
92
92
|
for (const row of rows) {
|
|
93
93
|
const found = declared.get(row.short.toLowerCase());
|
|
94
94
|
if (!found) {
|
|
95
|
-
report(file,
|
|
95
|
+
report(file, `«Контракт» carries \`${row.name}\`, and there is no procedure with such a method in ${roots.join(', ')}`);
|
|
96
96
|
continue;
|
|
97
97
|
}
|
|
98
98
|
described.add(row.short.toLowerCase());
|
|
99
99
|
if (found.permission && row.permission !== found.permission) {
|
|
100
100
|
report(
|
|
101
101
|
file,
|
|
102
|
-
|
|
102
|
+
`the permission of \`${row.name}\` diverged: in the spec «${row.permission}», ` + `in \`${found.file}\` it is declared «${found.permission}»`
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -108,29 +108,29 @@ function checkContract(file, text, roots) {
|
|
|
108
108
|
if (!described.has(key)) {
|
|
109
109
|
report(
|
|
110
110
|
file,
|
|
111
|
-
|
|
111
|
+
`the procedure \`${found.service}.${found.method}\` (${found.file}) belongs to the domain, ` + 'and the table of «Контракт» does not carry it'
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// ── 3.
|
|
117
|
+
// ── 3. Refusal codes ──────────────────────────────────────────────────────────
|
|
118
118
|
|
|
119
119
|
function checkRefusalCodes(file, text, roots) {
|
|
120
|
-
const section = sectionOf(text, '### Коды отказов');
|
|
120
|
+
const section = sectionOf(text, ['### Refusal codes', '### Коды отказов']);
|
|
121
121
|
const bullets = bulletsOf(section);
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
123
|
+
* "Not applicable" is a lawful answer here too. A domain that has procedures but not a single
|
|
124
|
+
* `Code.X` could not be described otherwise at all: the check rejects an empty section, and it
|
|
125
|
+
* rejects any written-out code all the more — there is no one in the domain to throw it. This
|
|
126
|
+
* is how the liveness check lives: it gives its refusal by an answer code, not by a procedure
|
|
127
|
+
* refusal.
|
|
128
128
|
*/
|
|
129
|
-
//
|
|
130
|
-
const notApplicable = section.some((line) =>
|
|
129
|
+
// Without `\b`: Cyrillic is not part of `\w`, so no word boundary arises after the word
|
|
130
|
+
const notApplicable = section.some((line) => /^(?:Not applicable|Не применимо)/.test(line.trim()));
|
|
131
131
|
if (!bullets.length) {
|
|
132
132
|
if (!notApplicable) {
|
|
133
|
-
report(file, '
|
|
133
|
+
report(file, 'the section `### Refusal codes` carries no code at all and no answer «Not applicable»');
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
return;
|
|
@@ -149,11 +149,11 @@ function checkRefusalCodes(file, text, roots) {
|
|
|
149
149
|
for (const bullet of bullets) {
|
|
150
150
|
const code = (bullet.text.match(/`([A-Za-z]\w*)`/) || [])[1];
|
|
151
151
|
if (!code) {
|
|
152
|
-
report(file,
|
|
152
|
+
report(file, `«Коды отказов» carries a line without a code in quotes: «${bullet.text.slice(0, 60)}…»`);
|
|
153
153
|
continue;
|
|
154
154
|
}
|
|
155
155
|
if (!thrown.has(code)) {
|
|
156
|
-
report(file,
|
|
156
|
+
report(file, `the refusal code \`${code}\` is thrown nowhere in the domain — either it is not from here, or the path does not give it`);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Product agreements waiting to move into the domain spec.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* A product agreement the code is already written by merges into the domain spec, and its directory
|
|
5
|
+
* is removed. Left in the main branch, it reads as proposed and not rolled out — that is, as a lie
|
|
6
|
+
* about an application that has been running for a month.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* The second question to it is age. A binding in a product agreement grows stale silently: the
|
|
9
|
+
* declaration it points at moves along with neighbouring work, and nobody will check the agreement
|
|
10
|
+
* against the code until it is merged. Three such lay for a month, and the miss was found exactly
|
|
11
|
+
* at the merge — that is, at the hour when fixing it costs the most.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Neither of the two is made a failure: in the middle of the work part of the tests already exist,
|
|
14
|
+
* and the work itself lawfully runs for weeks — a red audit would refuse the push of every branch,
|
|
15
|
+
* including the one that is finishing the agreement.
|
|
16
16
|
*/
|
|
17
17
|
import { execFileSync } from 'node:child_process';
|
|
18
18
|
|
|
19
19
|
import { ROOT } from './rt-kit-checks.config.mjs';
|
|
20
20
|
import { SPECS_DIR } from './spec-common.mjs';
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/** After how many days without edits a product agreement counts as stale. */
|
|
23
23
|
const STALE_PROPOSED_DAYS = 30;
|
|
24
24
|
|
|
25
|
-
/**
|
|
25
|
+
/** A day in milliseconds — age is easier to count in them. */
|
|
26
26
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* The directories of product agreements with the count of their scenarios.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Ready is the one whose scenarios are all closed by tests: while at least one is marked "not
|
|
32
|
+
* covered", the feature is not finished.
|
|
33
33
|
*/
|
|
34
34
|
export function proposedGroups(scenarios, references) {
|
|
35
35
|
const proposed = new Map();
|
|
@@ -56,15 +56,15 @@ export function proposedGroups(scenarios, references) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* The date of the last commit for every product agreement directory.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
61
|
+
* One pass over the history instead of a call per directory: the history goes newest first, so the
|
|
62
|
+
* first date met for a directory is its last one. A directory not yet in the history arrived by
|
|
63
|
+
* this very branch and cannot be old.
|
|
64
64
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
65
|
+
* Age is measured by the history, not by the file time on disk: a fresh checkout makes all the
|
|
66
|
+
* directories simultaneous, and there is no day in the text of the agreement at all. The same
|
|
67
|
+
* reason stands behind the age of archive records.
|
|
68
68
|
*/
|
|
69
69
|
function lastCommits(dirs) {
|
|
70
70
|
if (dirs.length === 0) {
|
|
@@ -106,7 +106,10 @@ function lastCommits(dirs) {
|
|
|
106
106
|
return dates;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Product agreements lying without edits longer than the term: the path and the age in days,
|
|
111
|
+
* the oldest first.
|
|
112
|
+
*/
|
|
110
113
|
export function staleProposed(dirs, now = Date.now()) {
|
|
111
114
|
const dates = lastCommits(dirs);
|
|
112
115
|
|