@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,29 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The words not written here: the section «Not written here» of the glossary against the tree.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The section lay without a single check, and exactly for that the divergence grew for years: the
|
|
6
|
+
* glossary called a service by one word, the tree by another, and both sides looked to be in force.
|
|
7
|
+
* The rule plainly orders to take the word from the glossary or to start it there, and nothing
|
|
8
|
+
* turned red — the address check reads paths, the spec check reads scenarios, and nobody reads the
|
|
9
|
+
* glossary.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The check travels with the package and is not written by the tree: the section «Not written here»
|
|
12
|
+
* is brought by the same package, and a tree that got the glossary and has no check over it lives
|
|
13
|
+
* with exactly the hole the check was started for. The words meanwhile belong to the glossary: the
|
|
14
|
+
* package does not list them but reads them from the section. What is common to the checks — the
|
|
15
|
+
* parsing of the known list and the list of skipped directories — arrives as the module of the
|
|
16
|
+
* check settings and is not written here anew.
|
|
15
17
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The left column of the pairs «forbidden on the left — accepted on the right» is searched for, and
|
|
19
|
+
* not all of it: a word with a bracketed clarification («приём (о службе)») is not judged by search
|
|
20
|
+
* at all. The clarification means exactly that one meaning of two is forbidden, and a machine has
|
|
21
|
+
* nothing to tell them apart in a line with: «операция приёма» is lawful and «приём принимает груз»
|
|
22
|
+
* is not, and both lines are the same for the search. Such a word stays a demand on the reader; the
|
|
23
|
+
* check says it out loud, so that silence is not read as coverage.
|
|
21
24
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* The glossary itself is taken out of the search: a forbidden word stands in it for the cause —
|
|
26
|
+
* that is what the left column lives by. The archive is taken out too: by its make-up it names what
|
|
27
|
+
* is no longer in the tree.
|
|
24
28
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* A non-zero exit code and the list of places; what piled up by the day the check was started is
|
|
30
|
+
* listed by name, with a reason and the number of a task.
|
|
27
31
|
*/
|
|
28
32
|
import { spawnSync } from 'node:child_process';
|
|
29
33
|
import { readFileSync } from 'node:fs';
|
|
@@ -33,26 +37,32 @@ import process from 'node:process';
|
|
|
33
37
|
import { CONFIG, ROOT, baselineOf, parseAllowlist } from './rt-kit-checks.config.mjs';
|
|
34
38
|
|
|
35
39
|
const GLOSSARY = 'docs/GLOSSARY.md';
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The section of forbidden words. There are two names: the English one is brought by the package,
|
|
42
|
+
* the Russian one is held by a tree whose glossary is its own and not translated yet. A new edition
|
|
43
|
+
* of the package is not entitled to leave such a tree without the check.
|
|
44
|
+
*/
|
|
45
|
+
const SECTIONS = ['## Not written here', '## Так не пишем'];
|
|
46
|
+
/** A pair of the glossary: `- **left** — right`. On the left there may be several words by comma. */
|
|
38
47
|
const PAIR = /^-\s+\*\*(.+?)\*\*\s+—/;
|
|
39
|
-
/**
|
|
48
|
+
/** A bracketed clarification at a word: one meaning of two is forbidden, and search cannot part them. */
|
|
40
49
|
const HINT = /\([^)]*\)\s*$/;
|
|
41
50
|
|
|
42
51
|
/**
|
|
43
|
-
*
|
|
52
|
+
* What the check does not read.
|
|
44
53
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
54
|
+
* Every glossary — the local one, its override and the source in the package — is taken out for the
|
|
55
|
+
* cause: the left column lives by naming the forbidden word out loud. The archive and the task
|
|
56
|
+
* folders are taken out by their make-up: the first lists what is no longer in the tree, the second
|
|
57
|
+
* dies with the merge.
|
|
48
58
|
*/
|
|
49
59
|
const UNREAD = ['docs/archive/', 'docs/tasks/', 'CHANGELOG'];
|
|
50
60
|
const GLOSSARY_NAME = /(^|\/)GLOSSARY\.md$/;
|
|
51
61
|
|
|
52
|
-
/**
|
|
62
|
+
/** The left column of the section of forbidden words: the words that must not be in the tree. */
|
|
53
63
|
function forbiddenWords(text) {
|
|
54
64
|
const lines = text.split('\n');
|
|
55
|
-
const from = lines.findIndex((line) => line.trim()
|
|
65
|
+
const from = lines.findIndex((line) => SECTIONS.includes(line.trim()));
|
|
56
66
|
if (from < 0) {
|
|
57
67
|
return { words: [], byReader: [] };
|
|
58
68
|
}
|
|
@@ -83,7 +93,7 @@ function forbiddenWords(text) {
|
|
|
83
93
|
return { words, byReader };
|
|
84
94
|
}
|
|
85
95
|
|
|
86
|
-
/**
|
|
96
|
+
/** The files of the tree the check reads. The list is taken from the version control system. */
|
|
87
97
|
function readableFiles() {
|
|
88
98
|
const listed = spawnSync('git', ['ls-files', '--cached', '--others', '--exclude-standard'], {
|
|
89
99
|
cwd: ROOT,
|
|
@@ -111,14 +121,14 @@ function main() {
|
|
|
111
121
|
try {
|
|
112
122
|
glossary = readFileSync(join(ROOT, GLOSSARY), 'utf8');
|
|
113
123
|
} catch {
|
|
114
|
-
console.log(`check-glossary:
|
|
124
|
+
console.log(`check-glossary: there is no glossary at ${GLOSSARY} — there is nothing to check with`);
|
|
115
125
|
|
|
116
126
|
return Number(process.env.RT_SKIP_CODE ?? 7);
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
const { words, byReader } = forbiddenWords(glossary);
|
|
120
130
|
if (!words.length && !byReader.length) {
|
|
121
|
-
console.log('check-glossary:
|
|
131
|
+
console.log('check-glossary: the glossary carries no section of banned words — there is nothing to check with');
|
|
122
132
|
|
|
123
133
|
return Number(process.env.RT_SKIP_CODE ?? 7);
|
|
124
134
|
}
|
|
@@ -149,19 +159,19 @@ function main() {
|
|
|
149
159
|
const news = found.filter((one) => fresh.includes(one.key));
|
|
150
160
|
|
|
151
161
|
if (news.length) {
|
|
152
|
-
console.error(`check-glossary:
|
|
162
|
+
console.error(`check-glossary: divergences ${news.length}`);
|
|
153
163
|
for (const one of news) {
|
|
154
|
-
console.error(` ${one.file}:${one.line} — «${one.word}»:
|
|
164
|
+
console.error(` ${one.file}:${one.line} — «${one.word}»: the word stands in the section of banned words of the glossary`);
|
|
155
165
|
}
|
|
156
|
-
console.error('
|
|
166
|
+
console.error(' either the word is changed to the one accepted here, or the glossary stops banning it');
|
|
157
167
|
|
|
158
168
|
return 1;
|
|
159
169
|
}
|
|
160
170
|
|
|
161
|
-
console.log(`check-glossary:
|
|
171
|
+
console.log(`check-glossary: banned words ${words.length}, documents read ${readableFiles().length}, no divergences`);
|
|
162
172
|
if (byReader.length) {
|
|
163
|
-
//
|
|
164
|
-
console.log(`
|
|
173
|
+
// Silence about a search that cannot be done would read as coverage: nothing judges these.
|
|
174
|
+
console.log(` not judged by search, they stay a requirement to the reader: ${byReader.join(', ')}`);
|
|
165
175
|
}
|
|
166
176
|
|
|
167
177
|
return 0;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The audit of a guard declaration against what its body branches on.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* A guard carries its own event and call pattern itself — by the `# rt-hook:` line in the second
|
|
6
|
+
* line of the file; the agent settings subscribe it by that line. The body meanwhile can do more
|
|
7
|
+
* than is declared: it branches on a tool name absent from the pattern — and the call never reaches
|
|
8
|
+
* that branch. From outside the guard looks like it works: the path is named, the file is laid out,
|
|
9
|
+
* the scenario set is green, because it calls the guard directly with substituted input and does
|
|
10
|
+
* not read the declaration at all.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Worse, the discrepancy reads as a miss of the tree. A tree that subscribed the guard wider than
|
|
13
|
+
* its declaration gets a refusal from the layout audit and narrows the subscription down to the
|
|
14
|
+
* declaration — removing the coverage that worked along with the discrepancy. This is fixed in the
|
|
15
|
+
* package, and the tree pays for it.
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* What is checked: tool names from the `case` branches on the tool name against the pattern of the
|
|
18
|
+
* declaration. Comments and refusal texts are not read: a tool name is mentioned there too, and
|
|
19
|
+
* what is judged is what the guard branches on.
|
|
18
20
|
*
|
|
19
|
-
* FAIL-OPEN:
|
|
21
|
+
* FAIL-OPEN: there is no hooks directory — nothing to check, zero code.
|
|
20
22
|
*
|
|
21
|
-
*
|
|
23
|
+
* A non-zero exit code and the list of discrepancies.
|
|
22
24
|
*/
|
|
23
25
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
24
26
|
import { join } from 'node:path';
|
|
@@ -26,13 +28,13 @@ import { join } from 'node:path';
|
|
|
26
28
|
const ROOT = process.cwd();
|
|
27
29
|
const HOOKS = join(ROOT, '.claude/hooks');
|
|
28
30
|
|
|
29
|
-
/**
|
|
31
|
+
/** The declaration of a guard: the event and the call pattern. */
|
|
30
32
|
const DECLARATION = /^#\s*rt-hook:\s*(\S+)(?:[ \t]+(\S.*))?$/m;
|
|
31
33
|
|
|
32
|
-
/**
|
|
34
|
+
/** A `case` branch on a tool name: `Bash | mcp__webstorm__execute_tool)`. */
|
|
33
35
|
const TOOL_CASE = /^[ \t]*([A-Za-z_][\w-]*(?:__[\w-]+)*(?:[ \t]*\|[ \t]*[A-Za-z_][\w-]*(?:__[\w-]+)*)*)\)/;
|
|
34
36
|
|
|
35
|
-
/**
|
|
37
|
+
/** The tool names the guard body branches on. */
|
|
36
38
|
function branchedTools(text) {
|
|
37
39
|
const lines = text.split('\n');
|
|
38
40
|
const tools = new Set();
|
|
@@ -59,7 +61,7 @@ function branchedTools(text) {
|
|
|
59
61
|
if (branch) {
|
|
60
62
|
for (const name of branch[1].split('|')) {
|
|
61
63
|
const tool = name.trim();
|
|
62
|
-
//
|
|
64
|
+
// The asterisk is the "everything else" branch, and it is not a tool name.
|
|
63
65
|
if (tool && tool !== '*') {
|
|
64
66
|
tools.add(tool);
|
|
65
67
|
}
|
|
@@ -70,20 +72,21 @@ function branchedTools(text) {
|
|
|
70
72
|
return [...tools];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
/**
|
|
75
|
+
/** Whether the pattern of the declaration covers this tool name. */
|
|
74
76
|
function covers(matcher, tool) {
|
|
75
77
|
try {
|
|
76
78
|
return new RegExp(`^(?:${matcher})$`).test(tool);
|
|
77
79
|
} catch {
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
+
// A pattern that cannot be parsed is a discrepancy of its own, and it may not be passed
|
|
81
|
+
// over in silence: a tool name under it will match nothing, while the declaration looks
|
|
82
|
+
// written.
|
|
80
83
|
return false;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
function main() {
|
|
85
88
|
if (!existsSync(HOOKS)) {
|
|
86
|
-
console.log('check-hook-scope:
|
|
89
|
+
console.log('check-hook-scope: the tree has no directory of hooks — there is nothing to check');
|
|
87
90
|
|
|
88
91
|
return 0;
|
|
89
92
|
}
|
|
@@ -100,25 +103,25 @@ function main() {
|
|
|
100
103
|
const matcher = declared[2].trim();
|
|
101
104
|
for (const tool of branchedTools(text)) {
|
|
102
105
|
if (!covers(matcher, tool)) {
|
|
103
|
-
faults.push(`${file}:
|
|
106
|
+
faults.push(`${file}: the body branches on «${tool}», and the declaration does not name it`);
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
if (faults.length > 0) {
|
|
109
|
-
console.log(`check-hook-scope:
|
|
112
|
+
console.log(`check-hook-scope: divergences ${faults.length}\n`);
|
|
110
113
|
|
|
111
114
|
for (const fault of faults) {
|
|
112
115
|
console.log(` ${fault}`);
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
console.log('\
|
|
116
|
-
console.log('
|
|
118
|
+
console.log('\nA branch of the body that is not in the declaration never runs: the guard is not called');
|
|
119
|
+
console.log('under that name. The declaration is edited in the source of the package, not in the laid-out copy.');
|
|
117
120
|
|
|
118
121
|
return 1;
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
console.log('check-hook-scope:
|
|
124
|
+
console.log('check-hook-scope: the declarations of the guards cover what their bodies branch on — it matches');
|
|
122
125
|
|
|
123
126
|
return 0;
|
|
124
127
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The check of the domain grid invariant: every domain has exactly the layers due to
|
|
4
|
+
* its form, and every lib has a name, tag, alias and configs matching its path.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Four forms of a domain:
|
|
7
|
+
* feature libs/{site,admin}/<domain>/ api, data-access, feature/<screen>+, shell, ui, util
|
|
8
|
+
* shared libs/{site,admin}/common/<domain>/ api, data-access, feature, ui, util (shell is an error)
|
|
9
|
+
* container the same five as the shared one
|
|
10
|
+
* backend libs/api/<domain>/ api, data-access, feature, util
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* `lib-domains.mjs`,
|
|
14
|
-
*
|
|
15
|
-
* `lib-reexports.mjs`,
|
|
16
|
-
*
|
|
12
|
+
* Every subject of the audit lives in a module of its own next door: the domain grid and the layer
|
|
13
|
+
* set — `lib-domains.mjs`, the files of a lib together with its name, tag and alias —
|
|
14
|
+
* `lib-manifests.mjs`, boundaries and dependency lists — `lib-boundaries.mjs`, barrels and
|
|
15
|
+
* re-exports — `lib-reexports.mjs`, the shared reading of the tree — `lib-common.mjs`. What is left
|
|
16
|
+
* here is the run: it collects the libs, calls every subject over them and puts what was found into
|
|
17
|
+
* one list.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* The exceptions are listed in tools/lib-layers-allowlist.json.
|
|
20
|
+
* A non-zero exit code and the list of discrepancies.
|
|
20
21
|
*/
|
|
21
22
|
import { existsSync } from 'node:fs';
|
|
22
23
|
import { join } from 'node:path';
|
|
@@ -28,12 +29,12 @@ import { checkAliases, checkLib } from './lib-manifests.mjs';
|
|
|
28
29
|
import { checkReexports } from './lib-reexports.mjs';
|
|
29
30
|
import { ROOT, allowlistOf, skipUnless } from './rt-kit-checks.config.mjs';
|
|
30
31
|
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
32
|
+
// There is nothing to check in a tree without a domain grid: not everyone who takes the package
|
|
33
|
+
// has a lib layout. While there was no skip, the very first install got the refusal "no
|
|
34
|
+
// tsconfig.base.json" — that is, a breakage instead of the answer "this layout is not here".
|
|
34
35
|
skipUnless(
|
|
35
36
|
LIB_ROOTS.some((root) => isDir(root)) && existsSync(join(ROOT, 'tsconfig.base.json')),
|
|
36
|
-
|
|
37
|
+
`the layout of the libs ${LIB_ROOTS.join(', ')} or the file tsconfig.base.json`
|
|
37
38
|
);
|
|
38
39
|
|
|
39
40
|
const domainLibs = collectAllDomainLibs();
|
|
@@ -41,7 +42,7 @@ const apiLibs = collectApiDomainLibs();
|
|
|
41
42
|
const flatLibs = collectFlatLibs();
|
|
42
43
|
const strays = collectStrayLibs([...domainLibs, ...apiLibs]);
|
|
43
44
|
|
|
44
|
-
strays.forEach((path) => report(path,
|
|
45
|
+
strays.forEach((path) => report(path, `the lib is outside the domain grid and is not listed in ${allowlistOf('lib-layers')}`));
|
|
45
46
|
domainLibs.forEach((libPath) => checkLib(libPath));
|
|
46
47
|
apiLibs.forEach((libPath) => checkLib(libPath, { requirePrefix: false }));
|
|
47
48
|
flatLibs.forEach((libPath) => checkLib(libPath, { requirePrefix: false }));
|
|
@@ -52,11 +53,11 @@ checkReexports();
|
|
|
52
53
|
await checkCoreLibs();
|
|
53
54
|
|
|
54
55
|
if (problems.length > 0) {
|
|
55
|
-
console.error(`check-lib-layers:
|
|
56
|
+
console.error(`check-lib-layers: divergences ${problems.length}\n`);
|
|
56
57
|
problems.forEach((problem) => console.error(` ${problem}`));
|
|
57
58
|
process.exit(1);
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
console.log(
|
|
61
|
-
`check-lib-layers: ${domainLibs.length}
|
|
62
|
+
`check-lib-layers: ${domainLibs.length} libs of the front domain grid, ${apiLibs.length} of the backend and ${flatLibs.length} flat ones, no divergences`
|
|
62
63
|
);
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Comparing the overrides of the profile with the tables of the companions.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* The rule says one thing and the tree works another way — and both places are lawful. The
|
|
6
|
+
* divergence is declared by a variable of the profile, while the reader looks for it in the
|
|
7
|
+
* companion of the rule, where it is listed what the words of the rule are called here. While
|
|
8
|
+
* nobody compares these two places, the companion promises the package default where the tree has
|
|
9
|
+
* long worked its own way: the rule demanded one form of the title of a PR, the tree replaced it
|
|
10
|
+
* with a variable, and the guard that read the form did not pull the number out at all — the check
|
|
11
|
+
* of the number silently did not run and looked as if it had come out right.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* What is compared: the name of every variable of the profile whose value has diverged from the
|
|
14
|
+
* package default, against the texts of the companions of the rules. The value is compared with
|
|
15
|
+
* nothing: a machine has nothing to tell whether it is right with, while naming what is replaced
|
|
16
|
+
* in the companion — that can be done.
|
|
15
17
|
*
|
|
16
|
-
* FAIL-OPEN:
|
|
17
|
-
*
|
|
18
|
+
* FAIL-OPEN: no profile, no defaults, no directory of rules — there is nothing to compare, a zero
|
|
19
|
+
* code. The tree is entitled to keep neither of them.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
21
|
+
* A non-zero exit code and the list of discrepancies.
|
|
20
22
|
*/
|
|
21
23
|
import { spawnSync } from 'node:child_process';
|
|
22
24
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
@@ -27,13 +29,13 @@ const PROFILE = join(ROOT, '.claude/rt-kit/project.sh');
|
|
|
27
29
|
const DEFAULTS = join(ROOT, '.claude/rt-kit/defaults/project.sh');
|
|
28
30
|
const RULES = join(ROOT, '.claude/skills');
|
|
29
31
|
|
|
30
|
-
/**
|
|
32
|
+
/** A top-level assignment: `RT_NAME='value'` or `RT_NAME="value"`. */
|
|
31
33
|
const ASSIGN = /^(RT_[A-Z0-9_]+)=(.*)$/;
|
|
32
34
|
|
|
33
|
-
/**
|
|
35
|
+
/** The package default: `RT_NAME="${RT_NAME:-value}"` — the value is taken from the substitution. */
|
|
34
36
|
const FALLBACK = /^RT_[A-Z0-9_]+="\$\{RT_[A-Z0-9_]+:-(.*)\}"$/;
|
|
35
37
|
|
|
36
|
-
/**
|
|
38
|
+
/** The value without the surrounding quotes: strings are compared, not the way they are written. */
|
|
37
39
|
function unquote(text) {
|
|
38
40
|
const trimmed = text.trim();
|
|
39
41
|
const paired = trimmed.length > 1 && (trimmed.startsWith("'") || trimmed.startsWith('"')) && trimmed.endsWith(trimmed[0]);
|
|
@@ -41,7 +43,7 @@ function unquote(text) {
|
|
|
41
43
|
return paired ? trimmed.slice(1, -1) : trimmed;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
/**
|
|
46
|
+
/** The map «name of the variable → value» by top-level assignments. */
|
|
45
47
|
function valuesOf(path) {
|
|
46
48
|
const values = new Map();
|
|
47
49
|
|
|
@@ -58,7 +60,7 @@ function valuesOf(path) {
|
|
|
58
60
|
return values;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
/**
|
|
63
|
+
/** The texts of all the companions of the tree, glued into one: a name is searched in them, not a place. */
|
|
62
64
|
function companionsText() {
|
|
63
65
|
if (!existsSync(RULES)) {
|
|
64
66
|
return null;
|
|
@@ -81,13 +83,14 @@ function companionsText() {
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/**
|
|
84
|
-
*
|
|
86
|
+
* The set of the push gate assembled by the shell: with the override of the tree and without it.
|
|
85
87
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
88
|
+
* It is assembled by a call, not by reading the text: the set is a function, and it looks at the
|
|
89
|
+
* tree — is there a setting of the layout, does a styling config lie there, is the scenario suite
|
|
90
|
+
* runnable. Read as text, it would name as commands what is not in this tree at all.
|
|
89
91
|
*
|
|
90
|
-
*
|
|
92
|
+
* Empty — there is nothing to assemble it with: no shell, no function, a refused call. Then there
|
|
93
|
+
* is nothing to compare.
|
|
91
94
|
*/
|
|
92
95
|
function gateSet(withProfile) {
|
|
93
96
|
const source = withProfile ? `. '${DEFAULTS}'; . '${PROFILE}';` : `. '${DEFAULTS}';`;
|
|
@@ -100,10 +103,11 @@ function gateSet(withProfile) {
|
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
106
|
+
* The checks named in the set — by the name of the file, not by the whole line of the command.
|
|
104
107
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
108
|
+
* The whole line is no good for the comparison: the tree is entitled to call the same check by
|
|
109
|
+
* another launcher or with another argument, and that is not a divergence. The loss of the check
|
|
110
|
+
* itself is one.
|
|
107
111
|
*/
|
|
108
112
|
function checksIn(lines) {
|
|
109
113
|
const names = new Set();
|
|
@@ -118,14 +122,15 @@ function checksIn(lines) {
|
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
/**
|
|
121
|
-
*
|
|
125
|
+
* The checks that the package default calls and the set of the tree does not.
|
|
122
126
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
+
* The set of the gate is assembled by the default and the override, and the override is entitled to
|
|
128
|
+
* declare the function anew. A check bitten out that way is indistinguishable from a check that is
|
|
129
|
+
* not in the tree at all: the gate is green because nobody called it, and the digest of the layout
|
|
130
|
+
* knows nothing about the set — it matches variables, and here a function is replaced.
|
|
127
131
|
*
|
|
128
|
-
*
|
|
132
|
+
* A refusal in favour of the work: there is nothing to assemble the set with — there are no lines,
|
|
133
|
+
* and the comparison goes on with its own business.
|
|
129
134
|
*/
|
|
130
135
|
function cutFromGate() {
|
|
131
136
|
const packaged = gateSet(false);
|
|
@@ -141,29 +146,29 @@ function cutFromGate() {
|
|
|
141
146
|
|
|
142
147
|
function main() {
|
|
143
148
|
if (!existsSync(PROFILE) || !existsSync(DEFAULTS)) {
|
|
144
|
-
console.log('check-profile-drift:
|
|
149
|
+
console.log('check-profile-drift: there is no tree profile or package defaults — there is nothing to check');
|
|
145
150
|
|
|
146
151
|
return 0;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
const companions = companionsText();
|
|
150
155
|
if (companions === null) {
|
|
151
|
-
console.log('check-profile-drift:
|
|
156
|
+
console.log('check-profile-drift: the tree has no companions of rules — there is nothing to check against');
|
|
152
157
|
|
|
153
158
|
return 0;
|
|
154
159
|
}
|
|
155
160
|
|
|
156
161
|
const cut = cutFromGate();
|
|
157
162
|
if (cut.length > 0) {
|
|
158
|
-
console.log(`check-profile-drift:
|
|
163
|
+
console.log(`check-profile-drift: the push gate set does not call checks of the default: ${cut.length}\n`);
|
|
159
164
|
|
|
160
165
|
for (const name of cut) {
|
|
161
166
|
console.log(` ${name}`);
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
console.log('\
|
|
165
|
-
console.log('
|
|
166
|
-
console.log('
|
|
169
|
+
console.log('\nThe gate set is assembled from the package default and the tree override. A check sifted');
|
|
170
|
+
console.log('out by the override is indistinguishable from a check the tree does not have: the gate is');
|
|
171
|
+
console.log('green because nobody called it. Return it to the set or explain the refusal in the companion of the delivery rule.');
|
|
167
172
|
|
|
168
173
|
return 1;
|
|
169
174
|
}
|
|
@@ -174,20 +179,20 @@ function main() {
|
|
|
174
179
|
const unnamed = overridden.filter(([name]) => !companions.includes(name));
|
|
175
180
|
|
|
176
181
|
if (unnamed.length > 0) {
|
|
177
|
-
console.log(`check-profile-drift:
|
|
182
|
+
console.log(`check-profile-drift: overridden ${overridden.length}, not named by a companion ${unnamed.length}\n`);
|
|
178
183
|
|
|
179
184
|
for (const [name, value] of unnamed) {
|
|
180
185
|
console.log(` ${name} = ${value.length > 60 ? `${value.slice(0, 57)}…` : value}`);
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
console.log('\
|
|
184
|
-
console.log('
|
|
185
|
-
console.log('
|
|
188
|
+
console.log('\nWhat is overridden is read in the companion of the rule: it lists what the rule says');
|
|
189
|
+
console.log('is called here. Left unnamed there, it leaves the reader the package default instead of');
|
|
190
|
+
console.log('what the tree actually works by.');
|
|
186
191
|
|
|
187
192
|
return 1;
|
|
188
193
|
}
|
|
189
194
|
|
|
190
|
-
console.log(`check-profile-drift:
|
|
195
|
+
console.log(`check-profile-drift: overridden ${overridden.length}, all named by companions — it matches`);
|
|
191
196
|
|
|
192
197
|
return 0;
|
|
193
198
|
}
|