@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,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The link between a task and an epic. Lives in a file of its own: the work queue audit stands at
|
|
3
|
+
* the length limit even without it, and these two checks are read separately.
|
|
4
4
|
*/
|
|
5
5
|
import { existsSync, readFileSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
@@ -9,17 +9,18 @@ import { TASK_KEY } from './board.mjs';
|
|
|
9
9
|
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* The label of an epic card. Not named — the link is not judged: there would be nothing left to
|
|
13
|
+
* tell an epic card from an ordinary task by.
|
|
14
14
|
*/
|
|
15
15
|
const EPIC_LABEL = CONFIG.board?.epicLabel ?? '';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* The rows of the epic makeup — those standing in the table with the task column.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* The epic plan holds other tables too: the sources of findings, the makeup of families, the count
|
|
21
|
+
* of items. Numbers taken from the whole text, and even from all the tables, would make an epic
|
|
22
|
+
* task out of everything it mentioned — the previous epic its findings grew from, a review, a task
|
|
23
|
+
* of a neighbouring tree.
|
|
23
24
|
*/
|
|
24
25
|
function planRows(plan) {
|
|
25
26
|
const rows = [];
|
|
@@ -31,9 +32,11 @@ function planRows(plan) {
|
|
|
31
32
|
continue;
|
|
32
33
|
}
|
|
33
34
|
if (!inside) {
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
35
|
+
// The column has two names, English and the owner's: a tree translates its plans one at
|
|
36
|
+
// a time, and one name would take the untranslated epics out of the check silently. A
|
|
37
|
+
// word boundary is no good here either: `\b` knows only Latin letters and never matches
|
|
38
|
+
// Cyrillic — the check would stay silent on any plan.
|
|
39
|
+
inside = /\|[^|]*(?:Task|Задача)/.test(line);
|
|
37
40
|
continue;
|
|
38
41
|
}
|
|
39
42
|
rows.push(line);
|
|
@@ -42,27 +45,43 @@ function planRows(plan) {
|
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
|
-
*
|
|
48
|
+
* The epic a task body declares itself under — or `undefined` where nothing is declared. With a
|
|
49
|
+
* number given, it answers whether that very epic is declared.
|
|
46
50
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
51
|
+
* Belonging is declared by a word about the task standing right before the word about the epic —
|
|
52
|
+
* the very shape the refusal dictates. Read by a bare mention of the number, every task that
|
|
53
|
+
* explains something about an epic got a false line: the number stands there in the reasoning, in
|
|
54
|
+
* a quoted refusal, in the list of what the work does not do. Both sides of the link read this one
|
|
55
|
+
* declaration: read differently, one side would demand what the other does not see.
|
|
56
|
+
*/
|
|
57
|
+
function declaredEpicOf(body, number = null) {
|
|
58
|
+
const named = body.match(new RegExp(`задач[аи]\\s+эпика?\\s+(?:#|${TASK_KEY}-)(\\d+)`, 'i'))?.[1];
|
|
59
|
+
return number === null ? named : named !== undefined && Number(named) === number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The link between a task and an epic, read in both directions.
|
|
64
|
+
*
|
|
65
|
+
* A task created under an epic names it in its body, and the epic plan names the task from its own
|
|
66
|
+
* side. A one-sided binding looks whole exactly as a two-sided one does: the reader comes now from
|
|
67
|
+
* the epic plan, now from its card, and the second side exists only for one of them. It held by
|
|
68
|
+
* imitation — while a body was written from the sample of a neighbouring task of the same epic, the
|
|
69
|
+
* line travelled with the shape, and a task created in the middle of work out of a finding was not
|
|
70
|
+
* written from a sample.
|
|
53
71
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
72
|
+
* The path to the plan is taken from the body of the epic card: it has to name it anyway, and a
|
|
73
|
+
* directory setting would create a second source of truth. A path counts as a spelling with a
|
|
74
|
+
* directory — a bare file name in the body occurs in prose and would lead the check to the very
|
|
75
|
+
* first mention. A plan absent from disk is a discrepancy of its own: the card points into
|
|
76
|
+
* emptiness.
|
|
58
77
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
78
|
+
* Only what is open is judged, as in the rest of the audit: a closed task of an epic is history,
|
|
79
|
+
* and there is nothing to close a line about it with.
|
|
61
80
|
*/
|
|
62
81
|
export function checkEpicLinks(open, report) {
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
82
|
+
// The label is not named — there is nothing to tell an epic card from an ordinary task by, and
|
|
83
|
+
// the check stays silent. Silent exactly so, not "there are no epics": a tree without epics and
|
|
84
|
+
// a tree that has not named the label are indistinguishable here.
|
|
66
85
|
if (!EPIC_LABEL) {
|
|
67
86
|
return;
|
|
68
87
|
}
|
|
@@ -70,20 +89,35 @@ export function checkEpicLinks(open, report) {
|
|
|
70
89
|
const byNumber = new Map(open.map((issue) => [issue.number, issue]));
|
|
71
90
|
const epics = open.filter((issue) => (issue.labels ?? []).some((label) => label.name === EPIC_LABEL));
|
|
72
91
|
const listedBy = new Map();
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
92
|
+
// Epics whose makeup could not be read. Their tasks are not judged from the other side: an
|
|
93
|
+
// unread plan has already been reported by a line of its own, and four lines "the task is not in
|
|
94
|
+
// the plan" beside it speak of the same miss again, naming other tasks as guilty.
|
|
76
95
|
const unreadable = new Set();
|
|
77
96
|
|
|
78
97
|
for (const epic of epics) {
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
report(`#${epic.number}:
|
|
98
|
+
const named = [...String(epic.body ?? '').matchAll(/(?:^|[\s(`])([\w.-]+(?:\/[\w.-]+)+\.md)/g)].map((match) => match[1]);
|
|
99
|
+
if (named.length === 0) {
|
|
100
|
+
report(`#${epic.number}: the epic card names no path to the plan — there is nowhere to read what the epic holds`);
|
|
82
101
|
unreadable.add(epic.number);
|
|
83
102
|
continue;
|
|
84
103
|
}
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
|
|
105
|
+
// The plan is the document that carries the makeup, not the first path in the body. A card
|
|
106
|
+
// names its decision next to its plan, and the decision has no table of tasks: read as the
|
|
107
|
+
// plan, it made the makeup empty and every open task of the epic read as not belonging to
|
|
108
|
+
// it — fourteen false lines at once, and the true ones drowned among them.
|
|
109
|
+
const onDisk = named.filter((path) => existsSync(join(ROOT, path)));
|
|
110
|
+
if (onDisk.length === 0) {
|
|
111
|
+
report(`#${epic.number}: the epic plan «${named[0]}» is not on disk — the card points into emptiness`);
|
|
112
|
+
unreadable.add(epic.number);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const planPath = onDisk.find((path) => planRows(readFileSync(join(ROOT, path), 'utf8')) !== '') ?? null;
|
|
117
|
+
if (planPath === null) {
|
|
118
|
+
report(
|
|
119
|
+
`#${epic.number}: none of the documents the card names carries the makeup of the epic — «${onDisk.join('», «')}». The makeup is a table with a task column`
|
|
120
|
+
);
|
|
87
121
|
unreadable.add(epic.number);
|
|
88
122
|
continue;
|
|
89
123
|
}
|
|
@@ -97,27 +131,27 @@ export function checkEpicLinks(open, report) {
|
|
|
97
131
|
}
|
|
98
132
|
listedBy.set(number, epic.number);
|
|
99
133
|
const body = String(byNumber.get(number).body ?? '');
|
|
100
|
-
if (!
|
|
134
|
+
if (!declaredEpicOf(body, epic.number)) {
|
|
101
135
|
report(
|
|
102
|
-
`#${number}:
|
|
136
|
+
`#${number}: the plan of the epic #${epic.number} names the task, and its body does not name the epic. Add the line «Задача эпика #${epic.number}, замысел — ${planPath}»`
|
|
103
137
|
);
|
|
104
138
|
}
|
|
105
139
|
}
|
|
106
140
|
}
|
|
107
141
|
|
|
108
|
-
//
|
|
109
|
-
//
|
|
142
|
+
// The other side: the body named the epic, and the epic plan does not know this task. It reads
|
|
143
|
+
// as a task under an epic, but "take the next one" will never hand it out.
|
|
110
144
|
const epicNumbers = new Set(epics.map((issue) => issue.number));
|
|
111
145
|
for (const issue of open) {
|
|
112
146
|
if (epicNumbers.has(issue.number)) {
|
|
113
147
|
continue;
|
|
114
148
|
}
|
|
115
|
-
const named = String(issue.body ?? '')
|
|
149
|
+
const named = declaredEpicOf(String(issue.body ?? ''));
|
|
116
150
|
if (named === undefined || !epicNumbers.has(Number(named)) || unreadable.has(Number(named))) {
|
|
117
151
|
continue;
|
|
118
152
|
}
|
|
119
153
|
if (listedBy.get(issue.number) !== Number(named)) {
|
|
120
|
-
report(`#${issue.number}:
|
|
154
|
+
report(`#${issue.number}: the body names the epic #${named}, and its plan does not carry the task — «take the next one» will not give it out`);
|
|
121
155
|
}
|
|
122
156
|
}
|
|
123
157
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Task branches that have not carried their folder in by a single commit — a part of the work queue
|
|
4
|
+
* audit.
|
|
5
|
+
*
|
|
6
|
+
* Moved into a file of its own because the audit itself has grown to the length limit: it has many
|
|
7
|
+
* subjects, and this one stands apart — it is the only one that reads the local repository and does
|
|
8
|
+
* without the network and without the hosting.
|
|
9
|
+
*/
|
|
10
|
+
import { execFileSync } from 'node:child_process';
|
|
11
|
+
|
|
12
|
+
import { TASK_KEY } from './board.mjs';
|
|
13
|
+
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The plan guard asks the folder from the disk, so an uncommitted one lets edits through for the
|
|
17
|
+
* whole of the work, and the refusal comes at the very end: the turn exit guard takes the sign of
|
|
18
|
+
* handed-over work from the branch history, and there is no folder there. At that minute there is
|
|
19
|
+
* nothing left to fix with — the folder was taken apart by one's own hands, and one assembled anew
|
|
20
|
+
* gives two extra commits in a ready PR.
|
|
21
|
+
*
|
|
22
|
+
* The branch history is judged, not its tip: the folder is taken apart by the last commit before
|
|
23
|
+
* the PR is opened, and the tip of finished work lawfully carries no folder.
|
|
24
|
+
*
|
|
25
|
+
* Read from the local repository, without the network: branches of other machines are not visible
|
|
26
|
+
* from here, and this check says nothing about them.
|
|
27
|
+
*/
|
|
28
|
+
export function checkBranchFolders(report, mainBranch) {
|
|
29
|
+
const git = (args) => execFileSync('git', args, { cwd: ROOT, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
30
|
+
|
|
31
|
+
let branches;
|
|
32
|
+
try {
|
|
33
|
+
branches = git(['branch', '--format=%(refname:short)', '--list', `${TASK_KEY}-*`]).split('\n');
|
|
34
|
+
} catch {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// A branch without a task number is lawful and lives locally — for a trial and a grill; it is
|
|
39
|
+
// due no folder, and demanding one would mean refusing work that will not go into the main
|
|
40
|
+
// branch.
|
|
41
|
+
const numbered = new RegExp(`^${TASK_KEY}-\\d+-`);
|
|
42
|
+
|
|
43
|
+
for (const branch of branches.map((one) => one.trim()).filter((one) => numbered.test(one))) {
|
|
44
|
+
try {
|
|
45
|
+
// The branch contribution is empty — nothing to judge: a folder is put in by the very
|
|
46
|
+
// first commit, not by creating it.
|
|
47
|
+
if (!git(['log', '--format=%h', '-1', `${mainBranch}..${branch}`]).trim()) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (git(['log', '--format=%h', '-1', branch, '--', `${CONFIG.tasksDir}/${branch}`]).trim()) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
report(
|
|
57
|
+
`${branch}: the task folder never travelled into the branch — commit ${CONFIG.tasksDir}/${branch}/, ` +
|
|
58
|
+
`otherwise the refusal arrives at the exit of a turn, when there is nothing left to fix`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The call to the hosting client: how it is found, what it is signed with and what counts as a
|
|
4
|
+
* temporary refusal.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Separated from the work with the work queue because the subject here is another one — not a task
|
|
7
|
+
* and not a column, but the call itself: where to get the executable, which token to sign it with,
|
|
8
|
+
* what to read as "there is no network" and what to repeat. Together with the queue this outgrew
|
|
9
|
+
* the file length limit.
|
|
8
10
|
*/
|
|
9
11
|
import { execFileSync } from 'node:child_process';
|
|
10
12
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -16,8 +18,8 @@ const BOARD = CONFIG.board ?? {};
|
|
|
16
18
|
const BOT_TOKEN_FILE = BOARD.tokenPath ? BOARD.tokenPath.replace(/^~/, homedir()) : '';
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
|
-
* `gh`
|
|
20
|
-
*
|
|
21
|
+
* The owner's `gh` is substituted by a password manager wrapper, and a call by name goes into it.
|
|
22
|
+
* So the real executable is tried first, and only then the name from PATH.
|
|
21
23
|
*/
|
|
22
24
|
function ghBinary() {
|
|
23
25
|
if (process.env.GH_BIN) {
|
|
@@ -28,9 +30,14 @@ function ghBinary() {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
33
|
+
* The machine account token lies outside the repository and does not get into the output. Its
|
|
34
|
+
* absence is not a refusal: a tree that has not named a token in `board.tokenPath` works with the
|
|
35
|
+
* queue under the account the hosting client is signed in as.
|
|
36
|
+
*
|
|
37
|
+
* The token is supplied by reading a task, moving a column and listing one's own PRs in dispute.
|
|
38
|
+
* Reading a PR goes without it deliberately: the review fields need rights to the organisation
|
|
39
|
+
* accounts, which the machine account was not given, and a request with the token is refused
|
|
40
|
+
* entirely. Whose eyes the answer was taken by is told by the `viewer` field in it.
|
|
34
41
|
*/
|
|
35
42
|
export function botToken() {
|
|
36
43
|
if (!existsSync(BOT_TOKEN_FILE)) {
|
|
@@ -43,9 +50,9 @@ export function botToken() {
|
|
|
43
50
|
export class OfflineError extends Error {}
|
|
44
51
|
|
|
45
52
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
53
|
+
* A network refusal differs from a refusal on the merits only by its text: `gh` answers
|
|
54
|
+
* both with a non-zero code. What lands here is what leaves nothing to check by — not
|
|
55
|
+
* what was checked and turned out wrong.
|
|
49
56
|
*/
|
|
50
57
|
function isOffline(stderr) {
|
|
51
58
|
return /dial tcp|no such host|network is unreachable|timeout|TLS handshake|connection refused|Bad credentials|authentication|not logged/i.test(
|
|
@@ -54,25 +61,26 @@ function isOffline(stderr) {
|
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
/**
|
|
57
|
-
*
|
|
64
|
+
* A refusal that passes by itself: the hosting answered but could not.
|
|
58
65
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
66
|
+
* It differs from a refusal on the merits in that a repeat lifts it: the five-hundred codes, the
|
|
67
|
+
* gateway and its timeout. A refusal by right, by a non-existent record and by an unknown column do
|
|
68
|
+
* not land here — they will not pass on the third try either, and would make one wait.
|
|
62
69
|
*/
|
|
63
70
|
function isUnavailable(stderr) {
|
|
64
71
|
return /HTTP 50[0234]\b|Bad Gateway|Service Unavailable|Gateway Time-?out|Server Error/i.test(stderr);
|
|
65
72
|
}
|
|
66
73
|
|
|
67
|
-
/**
|
|
74
|
+
/** How many times to try a call refused by the hosting being unavailable. */
|
|
68
75
|
const TRIES = 3;
|
|
69
76
|
|
|
70
77
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
78
|
+
* The pause before the next attempt, twice as long as the previous one. Synchronous: the hosting
|
|
79
|
+
* call here is synchronous too, and moving it into a promise would mean moving everyone who calls
|
|
80
|
+
* it along with it.
|
|
73
81
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
82
|
+
* The number is taken from the environment for the sake of the tests: they need no pause of their
|
|
83
|
+
* own, and are not obliged to wait three seconds for every scenario.
|
|
76
84
|
*/
|
|
77
85
|
const PAUSE_MS = Number(process.env.RT_GH_RETRY_MS ?? 1000) || 0;
|
|
78
86
|
|
|
@@ -95,17 +103,18 @@ export function gh(args, { token } = {}) {
|
|
|
95
103
|
} catch (error) {
|
|
96
104
|
const stderr = String(error.stderr ?? error.message ?? '');
|
|
97
105
|
if (error.code === 'ENOENT' || isOffline(stderr)) {
|
|
98
|
-
throw new OfflineError(stderr.trim() || 'gh
|
|
106
|
+
throw new OfflineError(stderr.trim() || 'gh is unavailable');
|
|
99
107
|
}
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
108
|
+
// The rule demands moving the column by the same motion as the work, and the hosting
|
|
109
|
+
// answered with unavailability for an hour straight: without a repeat the executor
|
|
110
|
+
// either turns the call by hand or leaves the column behind — and the audit finds that
|
|
111
|
+
// only after the PR is opened.
|
|
103
112
|
if (isUnavailable(stderr) && attempt < TRIES) {
|
|
104
113
|
pause(waited);
|
|
105
114
|
waited *= 2;
|
|
106
115
|
continue;
|
|
107
116
|
}
|
|
108
|
-
const failure = new Error(stderr.trim() || `gh ${args[0]}
|
|
117
|
+
const failure = new Error(stderr.trim() || `gh ${args[0]} finished with an error`);
|
|
109
118
|
failure.stderr = stderr;
|
|
110
119
|
throw failure;
|
|
111
120
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Work that cannot be closed in one session: the card label against the entry in the work plan.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* In a file of its own for the same reason as the epic link: the work queue audit stands at the
|
|
5
|
+
* length limit even without them, and these checks are read separately.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Such work is marked in two places, and one mark without the other lies silently: the executor
|
|
8
|
+
* opens the card before the work plan, and plans by the plan. A card without an entry promises
|
|
9
|
+
* several sessions the plan does not know about; an entry without a label leaves the card looking
|
|
10
|
+
* like work for one session — and the next session takes it expecting to close it in one go.
|
|
11
11
|
*/
|
|
12
12
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
13
13
|
import { join } from 'node:path';
|
|
@@ -16,14 +16,14 @@ import { TASK_KEY } from './board.mjs';
|
|
|
16
16
|
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* The label of a multi-session card and the directory of work plans. Either of the two not named —
|
|
20
|
+
* the link is not judged at all: there would be nothing to tell a multi-session card from an
|
|
21
|
+
* ordinary one by, and every tree has its own directory of plans.
|
|
22
22
|
*/
|
|
23
23
|
const LONG_LABEL = CONFIG.longWork?.label ?? '';
|
|
24
24
|
const PLANS_DIR = CONFIG.longWork?.plansDir ?? '';
|
|
25
25
|
|
|
26
|
-
/**
|
|
26
|
+
/** Work plan lines carrying the label word: only they count as an entry about several sessions. */
|
|
27
27
|
function markedRows() {
|
|
28
28
|
const dir = join(ROOT, PLANS_DIR);
|
|
29
29
|
if (!existsSync(dir)) {
|
|
@@ -43,14 +43,14 @@ function markedRows() {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* The link between the label and the work plan, read in both directions.
|
|
47
47
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* An entry is a line carrying both the label word and the task number. A bare mention of the number
|
|
49
|
+
* is no good: a work plan names all of its tasks, and most of them take one session — the other
|
|
50
|
+
* side would go red on every one.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* Only what is open is judged, as in the rest of the audit: a closed task is history, and there is
|
|
53
|
+
* nothing to close a line about it with.
|
|
54
54
|
*/
|
|
55
55
|
export function checkLongWork(open, report) {
|
|
56
56
|
if (!LONG_LABEL || !PLANS_DIR) {
|
|
@@ -59,13 +59,13 @@ export function checkLongWork(open, report) {
|
|
|
59
59
|
|
|
60
60
|
const rows = markedRows();
|
|
61
61
|
if (rows === null) {
|
|
62
|
-
report(
|
|
62
|
+
report(`the directory of work plans «${PLANS_DIR}» is not on disk — there is nothing to check multi-session work against`);
|
|
63
63
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
//
|
|
68
|
-
//
|
|
67
|
+
// The numbers named in the marked lines. Both the task key and the hash are read: a plan is
|
|
68
|
+
// written by a person, and the shape of a number in it differs from line to line.
|
|
69
69
|
const written = new Set();
|
|
70
70
|
const whereWritten = new Map();
|
|
71
71
|
for (const row of rows) {
|
|
@@ -85,17 +85,17 @@ export function checkLongWork(open, report) {
|
|
|
85
85
|
for (const number of labelled) {
|
|
86
86
|
if (!written.has(number)) {
|
|
87
87
|
report(
|
|
88
|
-
`#${number}:
|
|
88
|
+
`#${number}: marked as «${LONG_LABEL}», and the work plans «${PLANS_DIR}» carry no such line — the planning goes by the plan, not by the card`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
//
|
|
94
|
-
//
|
|
93
|
+
// The other side: the plan knows the work takes several sessions, while the card looks like
|
|
94
|
+
// work for one — and the next session takes it expecting to close it in one go.
|
|
95
95
|
const byNumber = new Set(open.map((issue) => issue.number));
|
|
96
96
|
for (const number of written) {
|
|
97
97
|
if (byNumber.has(number) && !labelled.has(number)) {
|
|
98
|
-
report(`#${number}:
|
|
98
|
+
report(`#${number}: the work plan «${whereWritten.get(number)}» knows it as multi-session, and the card carries no label «${LONG_LABEL}»`);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// The paths the pipeline does not listen to, and a PR whose contribution lies entirely under them.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// Moved out of the queue audit into a module of its own: parsing the pipeline patterns has nothing
|
|
4
|
+
// to do with the state of the work queue and reads on its own, while the audit was growing past the
|
|
5
|
+
// length limit because of it.
|
|
5
6
|
import { existsSync, readFileSync } from 'node:fs';
|
|
6
7
|
import { join } from 'node:path';
|
|
7
8
|
|
|
@@ -12,12 +13,12 @@ const PIPELINE = CONFIG.pushGate?.pipelineFile ?? '';
|
|
|
12
13
|
const HAS_PIPELINE = PIPELINE !== '' && existsSync(join(ROOT, PIPELINE));
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* The paths the pipeline does not listen to: the `paths-ignore` of its events.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Parsed line by line, not by a markup parser: the check has none, and the list is a flat
|
|
19
|
+
* enumeration of lines under one key. There can be several keys in the file — one per event — and
|
|
20
|
+
* they all add up into one set: a branch whose contribution lies entirely under them creates no run
|
|
21
|
+
* on any event.
|
|
21
22
|
*/
|
|
22
23
|
export function ignoredPaths() {
|
|
23
24
|
if (!HAS_PIPELINE) {
|
|
@@ -49,10 +50,13 @@ export function ignoredPaths() {
|
|
|
49
50
|
|
|
50
51
|
const IGNORED_PATHS = ignoredPaths();
|
|
51
52
|
|
|
52
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Pattern characters that have a meaning of their own in an expression: apart from the asterisks,
|
|
55
|
+
* they stand for themselves.
|
|
56
|
+
*/
|
|
53
57
|
const escapeForRegExp = (value) => value.replace(/[.+?^${}()|[\]\\-]/g, '\\$&');
|
|
54
58
|
|
|
55
|
-
/**
|
|
59
|
+
/** Whether a path falls under a pipeline pattern: `**` is any tail, `*` a piece of a name. */
|
|
56
60
|
function underPattern(path, pattern) {
|
|
57
61
|
const body = pattern
|
|
58
62
|
.split('**')
|
|
@@ -63,14 +67,15 @@ function underPattern(path, pattern) {
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
66
|
-
*
|
|
70
|
+
* The contribution of a PR lies entirely under the paths the pipeline does not listen to.
|
|
67
71
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
+
* Such a branch will never have a run, and demanding one is the same as demanding it of a branch
|
|
73
|
+
* without a single commit: the sign is true by the letter and lies on the merits, and the action it
|
|
74
|
+
* advises cannot be carried out. Meanwhile the red line stands next to real discrepancies and
|
|
75
|
+
* teaches one to skip the audit whole.
|
|
72
76
|
*
|
|
73
|
-
*
|
|
77
|
+
* The makeup cannot be read — we answer "no": staying silent at random costs more than one extra
|
|
78
|
+
* line.
|
|
74
79
|
*/
|
|
75
80
|
export function onlyIgnoredPaths(pull, options) {
|
|
76
81
|
if (!IGNORED_PATHS.length) {
|