@rt-tools/agent-kit 0.24.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/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 +149 -127
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +172 -164
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +91 -88
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +74 -71
- 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 +120 -37
- 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 +108 -97
- package/assets/defaults/project.sh +225 -185
- package/assets/defaults/shell.sh +73 -68
- 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 +30 -28
- 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 +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +45 -38
- 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 +196 -180
- package/assets/hooks/git-guard-main.sh +38 -34
- package/assets/hooks/git-guard-push-tests.sh +99 -87
- 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 +67 -58
- 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 +47 -42
- 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 +40 -37
- 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 +96 -44
- 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 -124
- package/assets/laws/work-conduct.md +250 -244
- 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 +124 -88
- package/assets/patterns/browser-verification-stand.md +169 -157
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +55 -37
- 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 +93 -86
- package/assets/patterns/git-workflow-commit.github.md +152 -141
- package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
- 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 +98 -93
- 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 +102 -101
- 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 -214
- 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 +198 -173
- 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 -239
- 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 -143
- 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 +81 -77
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -209
- 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 +235 -211
- 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 +5 -2
- 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 +12 -3
- package/lib/enroll.js.map +1 -1
- 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 +6 -2
- 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.24.0.tgz +0 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The check of the turn map: its size and its completeness.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* The map is put into the context by the hook of entry into the session — whole, before the first
|
|
6
|
+
* reply. That is what tells it from a rule: a rule the executor reads himself and pays a turn for
|
|
7
|
+
* it, the map comes for free. For free — while it is short: a map grown to the size of a rule eats
|
|
8
|
+
* the very window it was started for, and there is nothing to notice that with — it keeps coming
|
|
9
|
+
* and keeps being right.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The second thing that is not seen without the check: a state started in the rule and forgotten in
|
|
12
|
+
* the map. The session then gets the map, does not find its state in it and goes to read the rule —
|
|
13
|
+
* that is, the map works exactly up to the first new state.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Three things are checked:
|
|
16
|
+
* the size — the bytes of the laid-out map against the declared limit;
|
|
17
|
+
* the states — the names from the table of the rule against the names in the map, both ways;
|
|
18
|
+
* the exits — all four exits of a turn are named.
|
|
19
19
|
*
|
|
20
|
-
* FAIL-OPEN:
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* FAIL-OPEN: there is no map in the tree — nothing to check, a zero code. The tree may leave it
|
|
21
|
+
* unlaid. An empty table of states in the map counts as a refusal: that is not «there is nothing
|
|
22
|
+
* to check» but «the map is broken».
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* A non-zero exit code and the list of discrepancies.
|
|
25
25
|
*/
|
|
26
26
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
27
27
|
import { join } from 'node:path';
|
|
@@ -31,26 +31,26 @@ const MAP = join(ROOT, '.claude/rt-kit/defaults/turn-map.md');
|
|
|
31
31
|
const RULE = join(ROOT, '.claude/skills/task-flow/SKILL.md');
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* The size limit of the map in bytes.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* The number is one and lives here: the map comes into every session whole, and the limit for it is
|
|
37
|
+
* a property of the technique, not of the tree. Six kilobytes are taken by measurement, not by eye:
|
|
38
|
+
* on the day it was started the map weighs 4495 bytes, and the rule it is squeezed out of 63803.
|
|
39
|
+
* The spare of a kilobyte and a half is two or three new states; going past it, the map stops being
|
|
40
|
+
* a squeeze, and then it is to be split, not the limit raised.
|
|
41
41
|
*/
|
|
42
42
|
const LIMIT_BYTES = 6144;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* The names of the states: a row of a table whose first cell stands in backticks — and for the turn
|
|
46
|
+
* map a list line «- `имя` — действие; ведёт `паттерн`» as well. In the rule a list is not read this
|
|
47
|
+
* way: patterns are written there in the same form, and they would get into the states.
|
|
48
|
+
* whose first cell stands in backticks.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
50
|
+
* Both forms are read on purpose. A list is a third cheaper than a table — the formatter pads the
|
|
51
|
+
* columns with spaces up to a common width, and those spaces travel into the context of every
|
|
52
|
+
* session meaning nothing; the table meanwhile stays lawful, and a tree that has not rewritten it
|
|
53
|
+
* works as before.
|
|
54
54
|
*/
|
|
55
55
|
function statesOf(text, { listed: readListed = false } = {}) {
|
|
56
56
|
const states = [];
|
|
@@ -86,12 +86,20 @@ function statesOf(text, { listed: readListed = false } = {}) {
|
|
|
86
86
|
return states;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
89
|
+
/**
|
|
90
|
+
* The exits of a turn named by the law. Each has two names: the English one is brought by the
|
|
91
|
+
* package, the Russian one is held by a tree whose map is still its own. Either of the two is enough.
|
|
92
|
+
*/
|
|
93
|
+
const EXITS = [
|
|
94
|
+
['a question to the owner', 'вопрос владельцу'],
|
|
95
|
+
['a guard refusal', 'отказ гарда'],
|
|
96
|
+
['the window filled', 'заполненное окно'],
|
|
97
|
+
['work handed over', 'работа отдана'],
|
|
98
|
+
];
|
|
91
99
|
|
|
92
100
|
function main() {
|
|
93
101
|
if (!existsSync(MAP)) {
|
|
94
|
-
console.log('check-turn-map:
|
|
102
|
+
console.log('check-turn-map: the tree has no turn map — there is nothing to check');
|
|
95
103
|
|
|
96
104
|
return 0;
|
|
97
105
|
}
|
|
@@ -101,18 +109,18 @@ function main() {
|
|
|
101
109
|
const faults = [];
|
|
102
110
|
|
|
103
111
|
if (bytes > LIMIT_BYTES) {
|
|
104
|
-
faults.push(
|
|
112
|
+
faults.push(`the map has grown: ${bytes} bytes at a limit of ${LIMIT_BYTES}`);
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
const inMap = statesOf(text, { listed: true });
|
|
108
116
|
|
|
109
117
|
if (inMap.length === 0) {
|
|
110
|
-
faults.push('
|
|
118
|
+
faults.push('the map carries no state at all — the table is broken');
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
for (const state of inMap) {
|
|
114
122
|
if (!state.rest[0]) {
|
|
115
|
-
faults.push(`${state.name}:
|
|
123
|
+
faults.push(`${state.name}: the map carries no mandatory action`);
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
126
|
|
|
@@ -123,38 +131,38 @@ function main() {
|
|
|
123
131
|
|
|
124
132
|
for (const state of ruleNames) {
|
|
125
133
|
if (!mapNames.has(state)) {
|
|
126
|
-
faults.push(`${state}:
|
|
134
|
+
faults.push(`${state}: the state is declared by the rule and forgotten in the map`);
|
|
127
135
|
}
|
|
128
136
|
}
|
|
129
137
|
|
|
130
138
|
for (const state of mapNames) {
|
|
131
139
|
if (!ruleNames.has(state)) {
|
|
132
|
-
faults.push(`${state}:
|
|
140
|
+
faults.push(`${state}: the state stands in the map, and the rule does not declare it`);
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
}
|
|
136
144
|
|
|
137
|
-
for (const
|
|
138
|
-
if (!text.includes(
|
|
139
|
-
faults.push(
|
|
145
|
+
for (const names of EXITS) {
|
|
146
|
+
if (!names.some((name) => text.includes(name))) {
|
|
147
|
+
faults.push(`the turn exit «${names[0]}» is not named in the map`);
|
|
140
148
|
}
|
|
141
149
|
}
|
|
142
150
|
|
|
143
151
|
if (faults.length > 0) {
|
|
144
|
-
console.log(`check-turn-map:
|
|
152
|
+
console.log(`check-turn-map: divergences ${faults.length}, size ${bytes} bytes at a limit of ${LIMIT_BYTES}\n`);
|
|
145
153
|
|
|
146
154
|
for (const fault of faults) {
|
|
147
155
|
console.log(` ${fault}`);
|
|
148
156
|
}
|
|
149
157
|
|
|
150
|
-
console.log('\
|
|
151
|
-
console.log('
|
|
158
|
+
console.log('\nThe map is shorter than the rule — that is what makes it useful. Grown, it eats the very');
|
|
159
|
+
console.log('window it is put into the context for. It is edited in the package resource, not in the laid-out copy.');
|
|
152
160
|
|
|
153
161
|
return 1;
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
console.log(
|
|
157
|
-
`check-turn-map: ${inMap.length}
|
|
165
|
+
`check-turn-map: ${inMap.length} states, ${EXITS.length} turn exits, ` + `${bytes} bytes at a limit of ${LIMIT_BYTES} — it matches`
|
|
158
166
|
);
|
|
159
167
|
|
|
160
168
|
return 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `eslint/boundaries/domains/`,
|
|
2
|
+
* Boundaries and tags: where a lib is described as a source, whose dependency list must stay empty
|
|
3
|
+
* and what the family base sees. All three subjects read the same files
|
|
4
|
+
* `eslint/boundaries/domains/`, and they cannot be laid out apart.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* The name does not begin with `check-`: by walking such names the package default assembles the
|
|
7
|
+
* push gate set, and a helper with one would be run by the gate as a check of its own.
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
@@ -13,14 +13,14 @@ import { BOUNDARIES_DIR, FAMILIES, isDir, projectTag, report } from './lib-commo
|
|
|
13
13
|
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* A lib must be described by exactly one `sourceTag` and in exactly one boundaries file:
|
|
17
|
+
* a lib described twice means two different allowlists for it, and which one wins is a
|
|
18
|
+
* matter of the build order. In other allowlists the tag, on the contrary, occurs as many
|
|
19
|
+
* times as needed: that is the enumeration of those the lib is visible to.
|
|
20
20
|
*/
|
|
21
21
|
function checkBoundaries(libs) {
|
|
22
22
|
if (!isDir(BOUNDARIES_DIR)) {
|
|
23
|
-
report(BOUNDARIES_DIR, '
|
|
23
|
+
report(BOUNDARIES_DIR, 'there is no directory with boundary files');
|
|
24
24
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -38,20 +38,21 @@ function checkBoundaries(libs) {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
if (owners.length === 0) {
|
|
41
|
-
report(libPath,
|
|
41
|
+
report(libPath, `the tag ${tag} is described in no file of ${BOUNDARIES_DIR}/`);
|
|
42
42
|
} else if (owners.length > 1) {
|
|
43
|
-
report(libPath,
|
|
43
|
+
report(libPath, `the tag ${tag} is described ${owners.length} times: ${owners.join(', ')}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
49
|
+
* Libs whose dependency list must stay empty. The barrel of such a lib travels
|
|
50
|
+
* into the backend bundle, and the API build runs without tree-shaking: any dependency
|
|
51
|
+
* spreads from there across the whole graph.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* The tags are named by the tree: a tag name is its own word, and one hard-coded here would demand
|
|
54
|
+
* a boundaries description for a lib the tree does not have at all. Empty — the tree keeps no such
|
|
55
|
+
* libs.
|
|
55
56
|
*/
|
|
56
57
|
const NO_DEPENDENCY_TAGS = CONFIG.noDependencyTags;
|
|
57
58
|
|
|
@@ -79,42 +80,43 @@ function checkNoDependencyLibs() {
|
|
|
79
80
|
const opensAt = rest.indexOf('[', listAt);
|
|
80
81
|
const closesAt = rest.indexOf(']', opensAt);
|
|
81
82
|
if (listAt === -1 || opensAt === -1 || closesAt === -1) {
|
|
82
|
-
report(`${BOUNDARIES_DIR}/${name}`,
|
|
83
|
+
report(`${BOUNDARIES_DIR}/${name}`, `${tag} has no list of dependencies`);
|
|
83
84
|
continue;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
const dependencies = rest.slice(opensAt + 1, closesAt).trim();
|
|
87
88
|
if (dependencies.length > 0) {
|
|
88
|
-
report(`${BOUNDARIES_DIR}/${name}`, `${tag}
|
|
89
|
+
report(`${BOUNDARIES_DIR}/${name}`, `${tag} depends on nobody, and its list is not empty: ${dependencies}`);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
if (!described) {
|
|
93
|
-
report(BOUNDARIES_DIR,
|
|
94
|
+
report(BOUNDARIES_DIR, `the tag ${tag} is described in no boundary file`);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
100
|
+
* The family base sees `common/util` and the `util` layers of the shared domains of its
|
|
101
|
+
* own family. Everything beyond that is named by a line here: the base is called by every
|
|
102
|
+
* domain, and any dependency of it becomes shared by the whole family.
|
|
102
103
|
*/
|
|
103
104
|
const CORE_EXCEPTIONS = {
|
|
104
|
-
//
|
|
105
|
+
// The Connect transport in admin-transport.provider.ts: the sign-in descriptor and the
|
|
106
|
+
// transport token
|
|
105
107
|
'scope:admin-core': ['scope:common-proto', 'scope:common-connect'],
|
|
106
108
|
};
|
|
107
109
|
|
|
108
|
-
/** `scope
|
|
110
|
+
/** `scope:<family>-common-<domain>-util` — the `util` layer of a shared domain of the same family */
|
|
109
111
|
const isFamilyCommonUtil = (tag, family) => new RegExp(`^scope:${family}-common-[a-z0-9-]+-util$`).test(tag);
|
|
110
112
|
|
|
111
113
|
async function checkCoreLibs() {
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
114
|
+
// Not every tree with a domain grid has a boundaries index: it is assembled by a separate file,
|
|
115
|
+
// and while its absence was not handled the check fell on the import — that is, it answered a
|
|
116
|
+
// tree where boundaries are declared differently with a breakage.
|
|
115
117
|
const boundaries = join(ROOT, 'eslint/boundaries/index.mjs');
|
|
116
118
|
if (!existsSync(boundaries)) {
|
|
117
|
-
console.log('
|
|
119
|
+
console.log('skipped: the tree has no boundary digest eslint/boundaries/index.mjs');
|
|
118
120
|
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
@@ -134,7 +136,7 @@ async function checkCoreLibs() {
|
|
|
134
136
|
}
|
|
135
137
|
report(
|
|
136
138
|
`${BOUNDARIES_DIR}/${family}-core.config.mjs`,
|
|
137
|
-
`${tag}
|
|
139
|
+
`${tag} sees ${dependency}: the base of a family may reach only scope:common-util and scope:${family}-common-*-util`
|
|
138
140
|
);
|
|
139
141
|
}
|
|
140
142
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Common to every subject of the lib layout audit: the layer set of each domain form, reading the
|
|
3
|
+
* tree, the list of accepted debts and how a lib path yields its name, tag and alias.
|
|
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 under
|
|
7
|
+
* such a name would be run by the gate as a check of its own.
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
@@ -13,29 +13,30 @@ import { CONFIG, ROOT, parseAllowlist } from './rt-kit-checks.config.mjs';
|
|
|
13
13
|
|
|
14
14
|
const FAMILIES = CONFIG.families;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* The lib root and the backend family come from the tree settings, not from the code: in a tree
|
|
17
|
+
* that keeps its libs under another name the walk went past the code and the check went green on an
|
|
18
|
+
* empty directory — that is, it answered "no violations" where it had not looked at all.
|
|
19
19
|
*/
|
|
20
20
|
const LIBS_ROOT = CONFIG.libsRoot;
|
|
21
21
|
const API_FAMILY = CONFIG.apiFamily;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* The selector prefix mandatory for frontend libs. The word belongs to the tree entirely; empty
|
|
24
|
+
* means the prefix means nothing here, and the check says nothing about it.
|
|
25
25
|
*/
|
|
26
26
|
const LIB_PREFIX = CONFIG.libPrefix;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* `public-api.ts`,
|
|
30
|
-
*
|
|
28
|
+
* The names under which a barrel lies in this tree. There are several: a published package calls
|
|
29
|
+
* its own `public-api.ts`, while a lib of the domain grid calls it `index.ts`, and both live in one
|
|
30
|
+
* tree. A name not listed here does not count as a barrel, and its own file inside it is read as a
|
|
31
|
+
* re-export.
|
|
31
32
|
*/
|
|
32
33
|
const BARREL_FILES = CONFIG.barrelFiles;
|
|
33
34
|
const FLAT_LAYERS = ['api', 'data-access', 'ui', 'util'];
|
|
34
35
|
const FEATURE_DOMAIN_LAYERS = [...FLAT_LAYERS, 'feature', 'shell'].sort();
|
|
35
36
|
const COMMON_DOMAIN_LAYERS = [...FLAT_LAYERS, 'feature'].sort();
|
|
36
|
-
/**
|
|
37
|
+
/** The backend has no `ui` and no `shell`: it renders no markup and does no routing */
|
|
37
38
|
const API_DOMAIN_LAYERS = ['api', 'data-access', 'feature', 'util'];
|
|
38
|
-
/**
|
|
39
|
+
/** Where libs that ended up outside the domain grid are looked for */
|
|
39
40
|
const LIB_ROOTS = [...FAMILIES, API_FAMILY].map((family) => `${LIBS_ROOT}/${family}`);
|
|
40
41
|
const REQUIRED_FILES = ['project.json', 'tsconfig.json', 'vitest.config.mts', 'src/index.ts'];
|
|
41
42
|
const BOUNDARIES_DIR = 'eslint/boundaries/domains';
|
|
@@ -56,13 +57,13 @@ const dirsIn = (path) =>
|
|
|
56
57
|
const isLib = (path) => existsSync(join(ROOT, path, 'project.json'));
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* The list of accepted debts. Read through the settings helper, not directly: in a fresh tree the
|
|
61
|
+
* file does not exist at all, and a direct read dropped the check with a "no such file" refusal —
|
|
62
|
+
* that is, the very first install got a breakage instead of a report that there are no debts.
|
|
62
63
|
*/
|
|
63
|
-
// `flatLibRoots`
|
|
64
|
-
//
|
|
65
|
-
//
|
|
64
|
+
// `flatLibRoots` stands in the list alongside the rest: the collection of flat libs reads this side,
|
|
65
|
+
// and the parse did not gather it — the value came out empty and was silently substituted with an
|
|
66
|
+
// empty list. A tree with a non-empty set of flat roots got zero flat libs and a green check.
|
|
66
67
|
const allowlist = parseAllowlist('lib-layers', [
|
|
67
68
|
'notDomains',
|
|
68
69
|
'legacyDomains',
|
|
@@ -74,7 +75,7 @@ const allowlist = parseAllowlist('lib-layers', [
|
|
|
74
75
|
]);
|
|
75
76
|
const pathsOf = (key) => [...allowlist[key].keys()];
|
|
76
77
|
|
|
77
|
-
/**
|
|
78
|
+
/** The pattern `<root>/x/*` covers the `<root>/x` directory itself: the exception is lifted whole */
|
|
78
79
|
const matches = (patterns, path) =>
|
|
79
80
|
patterns.some((pattern) => {
|
|
80
81
|
if (!pattern.endsWith('/*')) {
|
|
@@ -85,19 +86,19 @@ const matches = (patterns, path) =>
|
|
|
85
86
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
86
87
|
});
|
|
87
88
|
|
|
88
|
-
/**
|
|
89
|
+
/** A directory that is not a domain at all: the family base, the shared libs, the backend */
|
|
89
90
|
const isNotDomain = (path) => matches(pathsOf('notDomains'), path);
|
|
90
91
|
|
|
91
|
-
/**
|
|
92
|
+
/** A domain of the old layout: checked neither as a domain nor as a set of libs — it leaves whole */
|
|
92
93
|
const isLegacyDomain = (path) => matches(pathsOf('legacyDomains'), path);
|
|
93
94
|
|
|
94
|
-
/**
|
|
95
|
+
/** A lib of the old layout inside a live domain: the domain is checked, the lib itself is not */
|
|
95
96
|
const isLegacyLib = (path) => matches(pathsOf('legacyLibs'), path);
|
|
96
97
|
|
|
97
|
-
/**
|
|
98
|
+
/** A domain allowed one filled layer: the reason is named in the exceptions list */
|
|
98
99
|
const isSingleLayerDomain = (path) => matches(pathsOf('singleLayerDomains'), path);
|
|
99
100
|
|
|
100
|
-
/**
|
|
101
|
+
/** Paths the lib walk must skip */
|
|
101
102
|
const isIgnoredLib = (path) => isNotDomain(path) || isLegacyDomain(path) || isLegacyLib(path);
|
|
102
103
|
|
|
103
104
|
const projectName = (libPath) => libPath.replace(/^libs\//, '').replaceAll('/', '-');
|
|
@@ -105,8 +106,8 @@ const projectTag = (libPath) => `scope:${projectName(libPath)}`;
|
|
|
105
106
|
const importAlias = (libPath) => `${CONFIG.importScope}/${libPath.slice(`${LIBS_ROOT}/`.length)}`;
|
|
106
107
|
|
|
107
108
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
109
|
+
* The files of a lib, except the barrel: an empty layer has a barrel just as a filled one does, and
|
|
110
|
+
* an empty layer cannot be told from a filled one by it.
|
|
110
111
|
*/
|
|
111
112
|
function sourceCount(libPath) {
|
|
112
113
|
const inside = (dir) => {
|