@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,30 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The check that the section of a state names the next move.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* A section breaking off at the last step reads as the end of the work: the executor brings the
|
|
6
|
+
* mandatory action to the end, reads the section through, finds no next move in it — and hands the
|
|
7
|
+
* turn over with a report of what was done. Two turns ended that way: one on a written plan, the
|
|
8
|
+
* second on a closed grill. The check of the states does not see this: it compares the names of the
|
|
9
|
+
* sections with the list and does not look inside.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* Four texts are read:
|
|
12
|
+
* the list — the table of states in the rule of work conduct: the name and the leading pattern;
|
|
13
|
+
* the sections — headings of the form «State `name`» or «Состояние `имя`» in those patterns;
|
|
14
|
+
* the rule — the same one: the statement about the boundary of a state stands in it;
|
|
15
|
+
* the map and the law — the same statement stands there, if the tree has laid them out.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* The line of the next move is recognised by its opening and names its own: one word-for-word line
|
|
18
|
+
* reads as a template and stops being noticed by the third section. That is why a repeated tail
|
|
19
|
+
* counts as a discrepancy on a par with its absence.
|
|
20
20
|
*
|
|
21
|
-
* FAIL-OPEN:
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* претензии.
|
|
21
|
+
* FAIL-OPEN: there is no rule of work conduct in the tree — nothing to check, a zero code. An empty
|
|
22
|
+
* table of states counts as a refusal: it means not «there is nothing to check» but «the list is
|
|
23
|
+
* broken». A leading pattern that is not in the tree is not judged here — it is named by the check
|
|
24
|
+
* of the states, and two refusals about one miss read as two claims.
|
|
26
25
|
*
|
|
27
|
-
*
|
|
26
|
+
* A non-zero exit code and the list of discrepancies.
|
|
28
27
|
*/
|
|
29
28
|
import { existsSync, readFileSync } from 'node:fs';
|
|
30
29
|
import { join } from 'node:path';
|
|
@@ -32,26 +31,39 @@ import { join } from 'node:path';
|
|
|
32
31
|
const ROOT = process.cwd();
|
|
33
32
|
const RULE = join(ROOT, '.claude/skills/task-flow/SKILL.md');
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* The rule of the conduct of a turn: the boundary of a state lives there, not in the rule of work
|
|
35
|
+
* conduct. They split apart when the rule of work conduct went past the length limit: the course of
|
|
36
|
+
* the work stayed in one, the exits of a turn moved into the other. A tree where only the first is
|
|
37
|
+
* laid out is judged by it alone — it has no second file.
|
|
39
38
|
*/
|
|
40
39
|
const TURN_RULE = join(ROOT, '.claude/skills/turn-conduct/SKILL.md');
|
|
41
40
|
const SKILLS = join(ROOT, '.claude/skills');
|
|
42
41
|
const MAP = join(ROOT, '.claude/rt-kit/defaults/turn-map.md');
|
|
43
42
|
const LAW = join(ROOT, 'docs/constitution/work-conduct.md');
|
|
44
43
|
|
|
45
|
-
/**
|
|
46
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The opening of the line: by it the line is found, while the tail of every section is its own.
|
|
46
|
+
* There are two names: the English one is brought by the package, the Russian one is held by a
|
|
47
|
+
* pattern of the tree that is not translated yet.
|
|
48
|
+
*/
|
|
49
|
+
const MARKERS = ['**Next move:**', '**Следующее движение:**'];
|
|
50
|
+
const MARKER = MARKERS[0];
|
|
51
|
+
const markerOf = (line) => MARKERS.find((one) => line.startsWith(one));
|
|
47
52
|
|
|
48
|
-
/**
|
|
49
|
-
|
|
53
|
+
/** The statement about the boundary of a state. Stands in the rule, the map and the law in the same words. */
|
|
54
|
+
/**
|
|
55
|
+
* The line about the boundary of a state. There are two names: the English one is brought by the
|
|
56
|
+
* package, the Russian one is held by the rule, the map and the law of the tree, which are not
|
|
57
|
+
* translated yet. Either of the two is enough.
|
|
58
|
+
*/
|
|
59
|
+
const BOUNDARIES = ['A transition from state to state', 'Переход из состояния в состояние'];
|
|
60
|
+
const BOUNDARY = BOUNDARIES[0];
|
|
61
|
+
const hasBoundary = (text) => BOUNDARIES.some((one) => text.includes(one));
|
|
50
62
|
|
|
51
|
-
/**
|
|
63
|
+
/** Shorter than this the tail names no move: an opening without a move is the same emptiness. */
|
|
52
64
|
const MIN_TAIL = 20;
|
|
53
65
|
|
|
54
|
-
/**
|
|
66
|
+
/** The name of the state and the pattern that leads it — from the table of the rule. */
|
|
55
67
|
function statesFromRule(text) {
|
|
56
68
|
const states = [];
|
|
57
69
|
|
|
@@ -80,7 +92,7 @@ function statesFromRule(text) {
|
|
|
80
92
|
return states;
|
|
81
93
|
}
|
|
82
94
|
|
|
83
|
-
/**
|
|
95
|
+
/** The state sections of a pattern: the name, the whole heading and the move lines found in the section. */
|
|
84
96
|
function sectionsOf(pattern) {
|
|
85
97
|
const file = join(SKILLS, pattern, 'SKILL.md');
|
|
86
98
|
|
|
@@ -92,7 +104,7 @@ function sectionsOf(pattern) {
|
|
|
92
104
|
let current = null;
|
|
93
105
|
|
|
94
106
|
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
95
|
-
const heading = line.match(/^#+\s
|
|
107
|
+
const heading = line.match(/^#+\s+(?:State|Состояние)\s+`([^`]+)`/);
|
|
96
108
|
|
|
97
109
|
if (heading) {
|
|
98
110
|
current = { name: heading[1], heading: line.replace(/^#+\s+/, ''), moves: [] };
|
|
@@ -100,8 +112,10 @@ function sectionsOf(pattern) {
|
|
|
100
112
|
continue;
|
|
101
113
|
}
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
115
|
+
const marker = current ? markerOf(line) : undefined;
|
|
116
|
+
|
|
117
|
+
if (marker) {
|
|
118
|
+
current.moves.push(line.slice(marker.length).trim());
|
|
105
119
|
}
|
|
106
120
|
}
|
|
107
121
|
|
|
@@ -109,7 +123,7 @@ function sectionsOf(pattern) {
|
|
|
109
123
|
}
|
|
110
124
|
|
|
111
125
|
if (!existsSync(RULE)) {
|
|
112
|
-
console.log('check-state-next:
|
|
126
|
+
console.log('check-state-next: the tree has no rule of work conduct — there is nothing to check');
|
|
113
127
|
process.exit(0);
|
|
114
128
|
}
|
|
115
129
|
|
|
@@ -117,7 +131,7 @@ const ruleText = readFileSync(RULE, 'utf8');
|
|
|
117
131
|
const states = statesFromRule(ruleText);
|
|
118
132
|
|
|
119
133
|
if (states.length === 0) {
|
|
120
|
-
console.error('check-state-next:
|
|
134
|
+
console.error('check-state-next: the rule of work conduct carries no table of states');
|
|
121
135
|
process.exit(1);
|
|
122
136
|
}
|
|
123
137
|
|
|
@@ -140,63 +154,63 @@ for (const [pattern, sections] of patterns) {
|
|
|
140
154
|
for (const section of sections) {
|
|
141
155
|
counted += 1;
|
|
142
156
|
|
|
143
|
-
const where = `\`${section.name}\`
|
|
157
|
+
const where = `\`${section.name}\` in the pattern \`${pattern}\``;
|
|
144
158
|
|
|
145
159
|
if (section.moves.length === 0) {
|
|
146
|
-
problems.push(`${where}:
|
|
160
|
+
problems.push(`${where}: the section «${section.heading}» carries neither the line «${MARKER}» nor «${MARKERS[1]}»`);
|
|
147
161
|
continue;
|
|
148
162
|
}
|
|
149
163
|
|
|
150
164
|
if (section.moves.length > 1) {
|
|
151
|
-
problems.push(`${where}:
|
|
165
|
+
problems.push(`${where}: the section «${section.heading}» carries ${section.moves.length} such lines, and the move is one`);
|
|
152
166
|
continue;
|
|
153
167
|
}
|
|
154
168
|
|
|
155
169
|
const tail = section.moves[0];
|
|
156
170
|
|
|
157
171
|
if (tail.length < MIN_TAIL) {
|
|
158
|
-
problems.push(`${where}:
|
|
172
|
+
problems.push(`${where}: the opening is there, and no move is named after it`);
|
|
159
173
|
continue;
|
|
160
174
|
}
|
|
161
175
|
|
|
162
176
|
const twin = tails.get(tail);
|
|
163
177
|
|
|
164
178
|
if (twin) {
|
|
165
|
-
problems.push(`${where}:
|
|
179
|
+
problems.push(`${where}: the move is word for word the same as at ${twin}`);
|
|
166
180
|
continue;
|
|
167
181
|
}
|
|
168
182
|
|
|
169
|
-
tails.set(tail, `\`${section.name}\`
|
|
183
|
+
tails.set(tail, `\`${section.name}\` in the pattern \`${pattern}\``);
|
|
170
184
|
}
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
if (counted === 0) {
|
|
174
|
-
problems.push('
|
|
188
|
+
problems.push('not a single state section was found: the patterns are not laid out or their headings are different');
|
|
175
189
|
}
|
|
176
190
|
|
|
177
191
|
const turnText = existsSync(TURN_RULE) ? readFileSync(TURN_RULE, 'utf8') : '';
|
|
178
|
-
if (!ruleText
|
|
179
|
-
problems.push(
|
|
192
|
+
if (!hasBoundary(ruleText) && !hasBoundary(turnText)) {
|
|
193
|
+
problems.push(`the rule of turn conduct says nothing about the boundary of a state: it carries no line «${BOUNDARY}»`);
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
for (const [file, what] of [
|
|
183
|
-
[MAP, '
|
|
184
|
-
[LAW, '
|
|
197
|
+
[MAP, 'the turn map'],
|
|
198
|
+
[LAW, 'the law on work conduct'],
|
|
185
199
|
]) {
|
|
186
|
-
if (existsSync(file) && !readFileSync(file, 'utf8')
|
|
187
|
-
problems.push(`${what}
|
|
200
|
+
if (existsSync(file) && !hasBoundary(readFileSync(file, 'utf8'))) {
|
|
201
|
+
problems.push(`${what} says nothing about the boundary of a state: it carries no line «${BOUNDARY}»`);
|
|
188
202
|
}
|
|
189
203
|
}
|
|
190
204
|
|
|
191
205
|
if (problems.length > 0) {
|
|
192
|
-
console.error(`check-state-next:
|
|
206
|
+
console.error(`check-state-next: divergences ${problems.length}`);
|
|
193
207
|
|
|
194
208
|
for (const problem of problems) {
|
|
195
209
|
console.error(` ${problem}`);
|
|
196
210
|
}
|
|
197
211
|
|
|
198
|
-
console.error('\
|
|
212
|
+
console.error('\nThe line of the next move stands in every state section: the opening is shared, the move is its own.');
|
|
199
213
|
process.exit(1);
|
|
200
214
|
}
|
|
201
215
|
|
|
202
|
-
console.log(`check-state-next:
|
|
216
|
+
console.log(`check-state-next: state sections ${counted}, each names its next move`);
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The audit of the list of work states against the pattern sections that lead them.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* A state without a leading text reads as the end of the work: the executor reads the
|
|
6
|
+
* pattern down to the last section, there is no next motion in it, and the turn ends
|
|
7
|
+
* with a report. That is how the state "the plan is written" stood — it occurred once,
|
|
8
|
+
* as a table cell, and the hole was found by an incident, not by a check. The analysis
|
|
9
|
+
* is the record "2026-08-21-turn-ended-at-the-written-plan" in the intake.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Two sets are checked against each other in both directions:
|
|
12
|
+
* the list — the table of states in the work-conduct rule: the name and the leading pattern;
|
|
13
|
+
* sections — headings of the form "State `name`", in English or in the Russian wording: the
|
|
14
|
+
* English name is carried by the package, the Russian one is held by a tree
|
|
15
|
+
* pattern that has not been translated yet.
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* A state without a section is a discrepancy. A section about a state outside the list
|
|
18
|
+
* is one too: otherwise a renamed state leaves its former section behind, and that one
|
|
19
|
+
* looks current.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* The leading pattern is taken from the table itself, not from file names: a section
|
|
22
|
+
* lying in a pattern other than the assigned one does not bring the reader to itself —
|
|
23
|
+
* the reader opens the assigned one.
|
|
22
24
|
*
|
|
23
|
-
* FAIL-OPEN:
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* FAIL-OPEN: there is no work-conduct rule in the tree — nothing to check, zero code.
|
|
26
|
+
* An empty table of states counts as a refusal: it means not "nothing to check" but
|
|
27
|
+
* "the list is broken".
|
|
26
28
|
*
|
|
27
|
-
*
|
|
29
|
+
* A non-zero exit code and the list of discrepancies.
|
|
28
30
|
*/
|
|
29
31
|
import { existsSync, readFileSync } from 'node:fs';
|
|
30
32
|
import { join } from 'node:path';
|
|
@@ -33,7 +35,7 @@ const ROOT = process.cwd();
|
|
|
33
35
|
const RULE = join(ROOT, '.claude/skills/task-flow/SKILL.md');
|
|
34
36
|
const SKILLS = join(ROOT, '.claude/skills');
|
|
35
37
|
|
|
36
|
-
/**
|
|
38
|
+
/** The state name and the pattern that leads it — from the table of the rule. */
|
|
37
39
|
function statesFromRule(text) {
|
|
38
40
|
const states = [];
|
|
39
41
|
|
|
@@ -62,7 +64,7 @@ function statesFromRule(text) {
|
|
|
62
64
|
return states;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
/**
|
|
67
|
+
/** The states a pattern has a section about. A heading of any level. */
|
|
66
68
|
function sectionsOf(pattern) {
|
|
67
69
|
const file = join(SKILLS, pattern, 'SKILL.md');
|
|
68
70
|
|
|
@@ -73,7 +75,7 @@ function sectionsOf(pattern) {
|
|
|
73
75
|
const found = new Set();
|
|
74
76
|
|
|
75
77
|
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
76
|
-
const heading = line.match(/^#+\s
|
|
78
|
+
const heading = line.match(/^#+\s+(?:State|Состояние)\s+`([^`]+)`/);
|
|
77
79
|
|
|
78
80
|
if (heading) {
|
|
79
81
|
found.add(heading[1]);
|
|
@@ -84,14 +86,14 @@ function sectionsOf(pattern) {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
if (!existsSync(RULE)) {
|
|
87
|
-
console.log('check-states:
|
|
89
|
+
console.log('check-states: the tree has no rule of work conduct — there is nothing to check');
|
|
88
90
|
process.exit(0);
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
const states = statesFromRule(readFileSync(RULE, 'utf8'));
|
|
92
94
|
|
|
93
95
|
if (states.length === 0) {
|
|
94
|
-
console.error('check-states:
|
|
96
|
+
console.error('check-states: the rule of work conduct carries no table of states');
|
|
95
97
|
process.exit(1);
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -107,12 +109,12 @@ for (const state of states) {
|
|
|
107
109
|
const sections = seen.get(state.pattern);
|
|
108
110
|
|
|
109
111
|
if (sections === null) {
|
|
110
|
-
problems.push(
|
|
112
|
+
problems.push(`the state \`${state.name}\`: the leading pattern \`${state.pattern}\` is not laid out in the tree`);
|
|
111
113
|
continue;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
if (!sections.has(state.name)) {
|
|
115
|
-
problems.push(
|
|
117
|
+
problems.push(`the state \`${state.name}\`: the pattern \`${state.pattern}\` carries neither the section «State \`${state.name}\`» nor «Состояние \`${state.name}\`»`);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
|
|
@@ -123,20 +125,20 @@ for (const [pattern, sections] of seen) {
|
|
|
123
125
|
|
|
124
126
|
for (const name of sections) {
|
|
125
127
|
if (!known.has(name)) {
|
|
126
|
-
problems.push(
|
|
128
|
+
problems.push(`the pattern \`${pattern}\`: a section about \`${name}\`, and there is no such state in the list`);
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
if (problems.length > 0) {
|
|
132
|
-
console.error(`check-states:
|
|
134
|
+
console.error(`check-states: divergences ${problems.length}`);
|
|
133
135
|
|
|
134
136
|
for (const problem of problems) {
|
|
135
137
|
console.error(` ${problem}`);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
console.error('\
|
|
140
|
+
console.error('\nThe list of states is the rule `task-flow`, the sections are the patterns next to it.');
|
|
139
141
|
process.exit(1);
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
console.log(`check-states:
|
|
144
|
+
console.log(`check-states: states ${states.length}, each has a section in its leading pattern`);
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The check that a BEM element class is backed by a rule.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* A class without a rule appears silently: the layout moves from the screen's file into the
|
|
6
|
+
* shared layer, and `rtElem` stays in the template and corresponds to nothing any more. Neither
|
|
7
|
+
* the linter nor the build nor the browser shows this — a superfluous class simply does nothing,
|
|
8
|
+
* and the markup grows names with nothing behind them.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* A match is counted by the element name, not by the pair "block — element": `rtElem` takes the
|
|
11
|
+
* block name from the nearest ancestor with `rtBlock`, and there is nothing to repeat that
|
|
12
|
+
* reasoning by over the text of the template. Because of this the check lets through a class that
|
|
13
|
+
* has a rule, but under a different block — the direction is chosen towards false misses rather
|
|
14
|
+
* than false refusals.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* What arrived with a connected package counts as a declaration too: a screen assembled from
|
|
17
|
+
* ready-made code keeps no declarations of its own at all. Exactly the file the application named
|
|
18
|
+
* itself is read — the walk is one step deep, and the dependencies directory does not get into
|
|
19
|
+
* the source roots.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* A dynamic `[rtElem]` does not count: the name there is known only at runtime.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* расхождением.
|
|
23
|
+
* What had accumulated by the moment the check was started lies in tools/styles-allowlist.json
|
|
24
|
+
* and does not count as a refusal: the gate falls on a NEW class without a rule, while the old
|
|
25
|
+
* stays a visible number in the digest. A line of the list is recognised by the class name: the
|
|
26
|
+
* list of files next to it changes with every edit of the markup, and audited whole it would make
|
|
27
|
+
* the former line superfluous and the very same debt a new divergence.
|
|
29
28
|
*
|
|
30
|
-
*
|
|
29
|
+
* A non-zero return code and a list of divergences.
|
|
31
30
|
*/
|
|
32
31
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
33
32
|
import { createRequire } from 'node:module';
|
|
@@ -40,22 +39,22 @@ const SOURCE_ROOTS = CONFIG.sourceRoots;
|
|
|
40
39
|
const SKIPPED_DIRS = CONFIG.skippedDirs;
|
|
41
40
|
|
|
42
41
|
const ELEM_RE = /rtElem="([a-z0-9-]+)"/g;
|
|
43
|
-
/**
|
|
42
|
+
/** The declaration of an element: both a nested `&__item` and a full `.<block>__item` */
|
|
44
43
|
const RULE_RE = /__([a-z0-9-]+)/g;
|
|
45
|
-
/**
|
|
44
|
+
/** The head of the nesting: the line an element block starts with */
|
|
46
45
|
const HEAD_RE = /^&__([a-z0-9-]+)/;
|
|
47
|
-
/**
|
|
46
|
+
/** A joint of the nesting: `&-<tail>` inside an element block appends to the name instead of starting its own */
|
|
48
47
|
const TAIL_RE = /^&-([a-z0-9-]+)/;
|
|
49
|
-
/**
|
|
48
|
+
/** A connection in a style file: `@use` and `@forward` are taken by one parse */
|
|
50
49
|
const USE_RE = /@(?:use|forward)\s+['"]([^'"]+)['"]/g;
|
|
51
|
-
/**
|
|
50
|
+
/** A line of the known list: the class name and the list of files next to it */
|
|
52
51
|
const KEY_RE = /^elem (\S+) @ (.*)$/;
|
|
53
52
|
|
|
54
53
|
const allowlist = parseAllowlist('styles');
|
|
55
54
|
const known = allowlist.keys;
|
|
56
55
|
const debt = new Set(allowlist.debt.keys());
|
|
57
56
|
|
|
58
|
-
/**
|
|
57
|
+
/** The lines of the list by class name: the list of files is part of the key but is audited apart */
|
|
59
58
|
const knownByName = new Map();
|
|
60
59
|
for (const key of known) {
|
|
61
60
|
const parsed = KEY_RE.exec(key);
|
|
@@ -81,8 +80,9 @@ function collectFiles(dir, extension) {
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* The package name and the path inside it. A relative and an absolute specifier are never a
|
|
84
|
+
* package; the prefixes `pkg:` and `~` are stripped — different bundlers call the same package by
|
|
85
|
+
* them.
|
|
86
86
|
*/
|
|
87
87
|
function packageOf(specifier) {
|
|
88
88
|
const clean = specifier.replace(/^pkg:/, '').replace(/^~/, '');
|
|
@@ -99,10 +99,10 @@ function packageOf(specifier) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
102
|
+
* The file of a package named by a connection. The directory is found by module resolution from
|
|
103
|
+
* the place where the connection is written: a subproject's package does not lie at the tree root
|
|
104
|
+
* at all, and the manager is free to keep several versions side by side. Not found — `null`: a
|
|
105
|
+
* tree without that package gets an audit of its own declarations, not a refusal to read.
|
|
106
106
|
*/
|
|
107
107
|
function fileOfPackage(from, { name, rest }) {
|
|
108
108
|
let manifest;
|
|
@@ -126,13 +126,13 @@ function fileOfPackage(from, { name, rest }) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* `__`
|
|
132
|
-
*
|
|
129
|
+
* The names of the elements declared by a style file. The name is assembled from the nesting:
|
|
130
|
+
* `&__head { &-icon }` declares `head-icon`, and it can have any number of joints. Reading only
|
|
131
|
+
* what stands after `__` whole, the check counted sound markup as a debt — the rule works, the
|
|
132
|
+
* class paints, and removing it would mean breaking the screen.
|
|
133
133
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
134
|
+
* A tail without a head does not become a name: `&-<tail>` standing outside an element block
|
|
135
|
+
* belongs to a different selector, and ascribing it would be inventing a declaration.
|
|
136
136
|
*/
|
|
137
137
|
function elementNames(text) {
|
|
138
138
|
const names = new Set();
|
|
@@ -167,8 +167,9 @@ function elementNames(text) {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
170
|
+
* The declarations from the packages connected by the application itself. Exactly the named file
|
|
171
|
+
* is read: the connections inside it are not parsed — what the application named is what counts
|
|
172
|
+
* as declared.
|
|
172
173
|
*/
|
|
173
174
|
function declarationsFromPackages(styleFiles) {
|
|
174
175
|
const names = new Set();
|
|
@@ -218,7 +219,7 @@ for (const [name, files] of [...usedIn].sort(([first], [second]) => first.locale
|
|
|
218
219
|
name,
|
|
219
220
|
files: new Set(files),
|
|
220
221
|
key: `elem ${name} @ ${where}`,
|
|
221
|
-
text: `rtElem="${name}" —
|
|
222
|
+
text: `rtElem="${name}" — there is no rule in any style file: ${where}`,
|
|
222
223
|
});
|
|
223
224
|
}
|
|
224
225
|
|
|
@@ -228,9 +229,9 @@ if (process.argv.includes('--baseline')) {
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
232
|
+
* How the list of files of a finding has diverged from the line of the list: what was added and
|
|
233
|
+
* what went away. Growth is a divergence, shrinking is a repair; they cannot be read alike, and
|
|
234
|
+
* auditing the key whole would mean declaring the very same debt a new one.
|
|
234
235
|
*/
|
|
235
236
|
function changedFiles(finding, line) {
|
|
236
237
|
return {
|
|
@@ -253,27 +254,27 @@ for (const finding of findings) {
|
|
|
253
254
|
|
|
254
255
|
const { added, gone } = changedFiles(finding, line);
|
|
255
256
|
if (added.length > 0) {
|
|
256
|
-
problems.push(`elem ${finding.name}:
|
|
257
|
+
problems.push(`elem ${finding.name}: the debt has grown — the class appeared also in ${added.join(', ')}; remove it from there`);
|
|
257
258
|
} else if (gone.length > 0) {
|
|
258
259
|
notes.push(
|
|
259
|
-
`elem ${finding.name}:
|
|
260
|
+
`elem ${finding.name}: the debt has shrunk — the class is no longer in ${gone.join(', ')}; the list in the entry can be fixed`
|
|
260
261
|
);
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
for (const key of known) {
|
|
265
266
|
if (!matchedKeys.has(key)) {
|
|
266
|
-
problems.push(`${key}:
|
|
267
|
+
problems.push(`${key}: listed in ${ALLOWLIST}, but the class is already backed by a rule — remove the line`);
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
if (problems.length > 0) {
|
|
271
|
-
console.error(`check-styles:
|
|
272
|
+
console.error(`check-styles: divergences ${problems.length}\n`);
|
|
272
273
|
problems.forEach((problem) => console.error(` ${problem}`));
|
|
273
274
|
process.exit(1);
|
|
274
275
|
}
|
|
275
276
|
|
|
276
277
|
notes.forEach((note) => console.log(` ${note}`));
|
|
277
278
|
console.log(
|
|
278
|
-
`check-styles:
|
|
279
|
+
`check-styles: classes without a rule ${findings.length}, of them accepted ${findings.length - debt.size}, debt ${debt.size} — no new ones`
|
|
279
280
|
);
|