@rt-tools/agent-kit 0.26.0 → 0.28.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/cargo-writer.md +54 -0
- package/assets/checks/board-epic-link.github.mjs +29 -0
- package/assets/checks/board-epic-plan.github.mjs +86 -0
- package/assets/checks/board-epics.github.mjs +217 -69
- package/assets/checks/board-long-work.github.mjs +5 -1
- package/assets/checks/board-pull-state.github.mjs +163 -0
- package/assets/checks/board-task-dirs.github.mjs +98 -0
- package/assets/checks/board.github.mjs +8 -91
- package/assets/checks/check-board.github.mjs +25 -165
- package/assets/checks/check-glossary.mjs +10 -2
- package/assets/checks/check-lib-layers.mjs +24 -1
- package/assets/checks/check-prose-style.mjs +19 -3
- package/assets/checks/check-reuse.mjs +26 -2
- package/assets/checks/check-schema-drift.mjs +19 -3
- package/assets/checks/check-specs.mjs +8 -1
- package/assets/checks/epic-table.github.mjs +268 -0
- package/assets/checks/lib-boundaries.mjs +2 -2
- package/assets/checks/lib-common.mjs +46 -0
- package/assets/checks/lib-manifests.mjs +18 -13
- package/assets/checks/rt-kit-checks.config.mjs +19 -0
- package/assets/checks/signals.mjs +39 -5
- package/assets/checks/spec-anchors.mjs +48 -4
- package/assets/checks/spec-common.mjs +40 -6
- package/assets/checks/spec-contract.mjs +33 -7
- package/assets/checks/spec-scenarios.mjs +24 -1
- package/assets/checks/specs-for.mjs +214 -0
- package/assets/checks/task-new.github.mjs +237 -6
- package/assets/commands/night.md +115 -0
- package/assets/defaults/gate-map.sh +20 -5
- package/assets/defaults/project.sh +13 -0
- package/assets/defaults/turn-map.md +3 -1
- package/assets/docs/GLOSSARY.md +22 -22
- package/assets/hooks/browser-device-id.sh +4 -0
- package/assets/hooks/browser-guard-device-id.sh +4 -0
- package/assets/hooks/commit-msg.sh +3 -0
- package/assets/hooks/dev-server-guard.sh +64 -31
- package/assets/hooks/epic-over.sh +49 -0
- package/assets/hooks/epic-stop-guard.sh +108 -0
- package/assets/hooks/exam-guard.sh +10 -10
- package/assets/hooks/git-guard-delivery-conflict.sh +56 -1
- package/assets/hooks/git-guard-delivery-draft.sh +10 -6
- package/assets/hooks/git-guard-delivery-epic.sh +167 -0
- package/assets/hooks/git-guard-delivery-signature.sh +32 -2
- package/assets/hooks/git-guard-delivery-tree.sh +50 -0
- package/assets/hooks/git-guard-delivery.sh +71 -27
- package/assets/hooks/git-guard-discard.sh +144 -0
- package/assets/hooks/git-guard-push-tests.sh +36 -16
- package/assets/hooks/handoff-entry-guard.sh +20 -2
- package/assets/hooks/prose-style-guard.sh +31 -8
- package/assets/hooks/qa-dataid-guard.sh +33 -11
- package/assets/hooks/reuse-first-guard.sh +29 -4
- package/assets/hooks/rule-article.sh +3 -0
- package/assets/hooks/rule-source-guard.sh +17 -2
- package/assets/hooks/skill-gate-layers.sh +4 -0
- package/assets/hooks/skill-gate.sh +7 -0
- package/assets/hooks/skill-loaded.sh +4 -0
- package/assets/hooks/sql-guard-parse.sh +3 -0
- package/assets/hooks/sql-guard-request.sh +3 -0
- package/assets/hooks/sql-guard-target.sh +3 -0
- package/assets/hooks/sql-guard-write.sh +21 -2
- package/assets/hooks/stand-login-guard.sh +3 -0
- package/assets/hooks/turn-exit-guard.sh +55 -67
- package/assets/hooks/turn-exit-patterns.sh +28 -1
- package/assets/hooks/turn-exit-verdict.sh +84 -0
- package/assets/hooks/utf8.sh +3 -0
- package/assets/hooks/waiting-turn-guard.sh +11 -1
- package/assets/hooks/write-targets.sh +3 -0
- package/assets/laws/delivery.md +37 -7
- package/assets/laws/verifiability.md +22 -4
- package/assets/patterns/git-workflow-commit.azure.md +1 -1
- package/assets/patterns/git-workflow-commit.github.md +9 -2
- package/assets/patterns/git-workflow-commit.gitlab.md +1 -1
- package/assets/patterns/git-workflow-merge.md +8 -5
- package/assets/patterns/git-workflow-pr.azure.md +1 -1
- package/assets/patterns/git-workflow-pr.github.md +44 -18
- package/assets/patterns/git-workflow-pr.gitlab.md +1 -1
- package/assets/patterns/git-workflow-stack.md +32 -9
- package/assets/patterns/status-report-table.github.md +11 -0
- package/assets/patterns/task-flow-close.md +96 -90
- package/assets/patterns/task-flow-start.md +40 -26
- package/assets/patterns/ts-procedure.md +6 -0
- package/assets/pitfalls/agent-kit.md +19 -0
- package/assets/pitfalls/git-workflow.github.md +44 -0
- package/assets/pitfalls/task-flow.md +25 -23
- package/assets/rules/autonomous-work.md +15 -3
- package/assets/rules/browser-verification.md +8 -0
- package/assets/rules/deploy-flow.github.md +6 -0
- package/assets/rules/doc-style.md +13 -4
- package/assets/rules/git-workflow.azure.md +10 -0
- package/assets/rules/git-workflow.github.md +144 -126
- package/assets/rules/git-workflow.gitlab.md +10 -0
- package/assets/rules/lib-layers.md +11 -0
- package/assets/rules/spec-driven.md +17 -1
- package/assets/rules/status-report.md +7 -0
- package/assets/rules/task-flow.md +78 -54
- package/assets/rules/testing.md +7 -0
- package/assets/rules/turn-conduct.md +30 -3
- package/assets/samples/tasks/_template/plan.md +4 -1
- package/assets/skills/agent-kit.md +40 -25
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +9 -2
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo-prose.d.ts +41 -0
- package/lib/cargo-prose.d.ts.map +1 -0
- package/lib/cargo-prose.js +88 -0
- package/lib/cargo-prose.js.map +1 -0
- package/lib/cargo.d.ts +12 -1
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +8 -2
- package/lib/cargo.js.map +1 -1
- package/lib/commands.d.ts +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +59 -2
- package/lib/commands.js.map +1 -1
- package/lib/fate.d.ts +29 -0
- package/lib/fate.d.ts.map +1 -0
- package/lib/fate.js +147 -0
- package/lib/fate.js.map +1 -0
- package/lib/hooks-map.d.ts +5 -0
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +9 -3
- package/lib/hooks-map.js.map +1 -1
- package/lib/override-marks.d.ts +7 -0
- package/lib/override-marks.d.ts.map +1 -1
- package/lib/override-marks.js +14 -0
- package/lib/override-marks.js.map +1 -1
- package/lib/plan.d.ts +2 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +8 -0
- package/lib/plan.js.map +1 -1
- package/lib/proposals.d.ts +25 -0
- package/lib/proposals.d.ts.map +1 -1
- package/lib/proposals.js +43 -1
- package/lib/proposals.js.map +1 -1
- package/lib/ship.d.ts +29 -2
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +34 -0
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.fixture.d.ts +8 -1
- package/lib/shipment.fixture.d.ts.map +1 -1
- package/lib/shipment.fixture.js +9 -0
- package/lib/shipment.fixture.js.map +1 -1
- package/lib/shipment.js +40 -14
- package/lib/shipment.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.28.0.tgz +0 -0
- package/rt-tools-agent-kit-0.26.0.tgz +0 -0
|
@@ -215,13 +215,29 @@ async function main() {
|
|
|
215
215
|
// The identifier is quoted: the database name comes from the address, not from the text of the query
|
|
216
216
|
const quoted = `"${shadowName.replace(/"/g, '""')}"`;
|
|
217
217
|
await client.query(`DROP DATABASE IF EXISTS ${quoted}`);
|
|
218
|
+
// The shadow database is created here rather than left to `migrate deploy`. The seventh
|
|
219
|
+
// edition of the client goes to the storage through an adapter and creates nothing: a
|
|
220
|
+
// missing database it answers with `P1001`, «Can't reach database server», while the server
|
|
221
|
+
// answers and the port is open. Read as it is written, that refusal says the machine has no
|
|
222
|
+
// storage at all — and the check created to catch a migration that falls on a clean database
|
|
223
|
+
// stayed silent about exactly that.
|
|
224
|
+
await client.query(`CREATE DATABASE ${quoted}`);
|
|
218
225
|
|
|
219
226
|
try {
|
|
220
|
-
// `migrate deploy` starts the database itself: no creation command of our own is needed
|
|
221
227
|
const deploy = prisma(['migrate', 'deploy'], shadowUrl);
|
|
222
228
|
if (deploy.status !== 0) {
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
const said = `${deploy.stdout ?? ''}${deploy.stderr ?? ''}`;
|
|
230
|
+
// `P1001` names an unreachable server, and the client says it about a missing
|
|
231
|
+
// database too — the two are indistinguishable in its answer. The shadow database
|
|
232
|
+
// was created a line above, so here it means the check itself, not the migrations:
|
|
233
|
+
// said as a refusal of the migrations, it sends whoever reads it to look for a
|
|
234
|
+
// divergence that does not exist.
|
|
235
|
+
console.error(
|
|
236
|
+
said.includes('P1001')
|
|
237
|
+
? 'check-schema-drift: the shadow database did not answer, and this is a defect of the check rather than of the migrations\n'
|
|
238
|
+
: 'check-schema-drift: the migrations do not apply to a clean database\n'
|
|
239
|
+
);
|
|
240
|
+
console.error(said);
|
|
225
241
|
|
|
226
242
|
return 1;
|
|
227
243
|
}
|
|
@@ -52,7 +52,7 @@ import { checkRuleImplementation, checkSpecLaws, checkTracedAnchors } from './sp
|
|
|
52
52
|
import { CONSTITUTION_DIR, REQUIRED_HEADINGS, SPECS_DIR, collectDomains, exists, problems, read, report, walk } from './spec-common.mjs';
|
|
53
53
|
import { checkContract, checkRefusalCodes, procedureRootsOf } from './spec-contract.mjs';
|
|
54
54
|
import { proposedGroups, staleProposed } from './spec-proposed.mjs';
|
|
55
|
-
import { collectReferences, parseScenarios, promisesScreen } from './spec-scenarios.mjs';
|
|
55
|
+
import { collectReferences, parseScenarios, promisesScreen, unparsedHeadings } from './spec-scenarios.mjs';
|
|
56
56
|
|
|
57
57
|
// ── run ───────────────────────────────────────────────────────────────────────
|
|
58
58
|
|
|
@@ -158,6 +158,13 @@ for (const domain of domains) {
|
|
|
158
158
|
|
|
159
159
|
const found = walk(base, (name) => name === 'scenarios.md').flatMap(parseScenarios);
|
|
160
160
|
|
|
161
|
+
// A heading the template did not take starts no scenario and, left unnamed, takes it out of
|
|
162
|
+
// the count silently: the coverage marks under it are not read either, and a test referring to
|
|
163
|
+
// its number does not turn red — references are looked for among the parsed ones.
|
|
164
|
+
for (const heading of walk(base, (name) => name === 'scenarios.md').flatMap(unparsedHeadings)) {
|
|
165
|
+
report(`${heading.file}:${heading.line}`, `the scenario heading is not taken by the template and counts as ordinary prose: ${heading.text}`);
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
// The prefix belongs to the domain together with its subdomains, not to a separate directory.
|
|
162
169
|
// A domain is split when its spec has outgrown the length limit, and the scenarios move into
|
|
163
170
|
// the subdomains unchanged: the number is the only thing binding a scenario to a test title,
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// rt-kit v0.26.0 · checks/epic-table.github.mjs · ca65adf7e1b9 · правится надстройкой, не здесь
|
|
3
|
+
/**
|
|
4
|
+
* The table of the epic's tasks: the order from the plan, the state from the hosting.
|
|
5
|
+
*
|
|
6
|
+
* The shape of the answer to the question "where is the work" is written down — the rule of the
|
|
7
|
+
* status report and the pattern next to it — and the table itself was assembled by the session: it
|
|
8
|
+
* remembered which calls to make and how to fold the answers into cells. A session that has just
|
|
9
|
+
* started remembers none of that, and two sessions fold the same answers differently: one names the
|
|
10
|
+
* run on the head, another the last run of the branch.
|
|
11
|
+
*
|
|
12
|
+
* node tools/epic-table.mjs # the epic of the current branch
|
|
13
|
+
* node tools/epic-table.mjs 1940 # the epic named by its number
|
|
14
|
+
*
|
|
15
|
+
* The answer goes to the standard output and is carried to the owner as it is. A non-zero code
|
|
16
|
+
* means the table was not assembled, and then no table is printed at all: an empty one reads as an
|
|
17
|
+
* empty epic.
|
|
18
|
+
*/
|
|
19
|
+
import { execFileSync } from 'node:child_process';
|
|
20
|
+
import { readFileSync } from 'node:fs';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
|
|
23
|
+
import { OfflineError, TASK_KEY, botToken, fetchBoard, fetchOpenPulls, ghJson, numberFromBranch, numberFromTitle } from './board.mjs';
|
|
24
|
+
import { declaredEpicOf, planPathOf, planRows } from './board-epics.mjs';
|
|
25
|
+
import { verdictOnHead } from './board-runs.mjs';
|
|
26
|
+
import { ROOT } from './rt-kit-checks.config.mjs';
|
|
27
|
+
|
|
28
|
+
/** The machine mode: the numbers of the unfinished tasks instead of the table for the owner. */
|
|
29
|
+
const UNFINISHED = '--unfinished';
|
|
30
|
+
|
|
31
|
+
/** The machine account's token is substituted per call, as everywhere in the work with the queue. */
|
|
32
|
+
const OPTIONS = { token: botToken() };
|
|
33
|
+
|
|
34
|
+
/** How the outcome of the run is named in the cell: the word of the hosting says nothing to the owner. */
|
|
35
|
+
const VERDICT = {
|
|
36
|
+
success: 'зелёный',
|
|
37
|
+
failure: 'красный',
|
|
38
|
+
running: 'идёт',
|
|
39
|
+
none: 'не начинался',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** The current branch: the task number is read from it when the epic is not named by an argument. */
|
|
43
|
+
function branchOf() {
|
|
44
|
+
try {
|
|
45
|
+
return execFileSync('git', ['branch', '--show-current'], { cwd: ROOT, encoding: 'utf8' }).trim();
|
|
46
|
+
} catch {
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A card with its body: the belonging to an epic and the path to the plan are declared exactly
|
|
53
|
+
* there, and the reading of the queue takes the body of the task apart, not its title.
|
|
54
|
+
*/
|
|
55
|
+
function issueOf(number) {
|
|
56
|
+
try {
|
|
57
|
+
return ghJson(['issue', 'view', String(number), '--json', 'number,title,state,body,labels'], OPTIONS);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (error instanceof OfflineError) {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Which epic is asked about: the argument names it, and without an argument it is taken from the
|
|
68
|
+
* current branch — the branch gives the task, the body of the task declares the epic.
|
|
69
|
+
*/
|
|
70
|
+
function epicAsked(argv) {
|
|
71
|
+
const named = argv.map((one) => one.replace(/^#/, '')).find((one) => /^\d+$/.test(one));
|
|
72
|
+
if (named !== undefined) {
|
|
73
|
+
return { number: Number(named), why: '' };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const branch = branchOf();
|
|
77
|
+
const number = numberFromBranch(branch);
|
|
78
|
+
if (number === null) {
|
|
79
|
+
return { number: null, why: `ветка «${branch}» не несёт номера задачи — назовите эпик доводом: node tools/epic-table.mjs <номер>` };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const issue = issueOf(number);
|
|
83
|
+
if (!issue) {
|
|
84
|
+
return { number: null, why: `у хостинга нет задачи #${number} — назовите эпик доводом` };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const declared = declaredEpicOf(String(issue.body ?? ''));
|
|
88
|
+
if (declared === undefined) {
|
|
89
|
+
return {
|
|
90
|
+
number: null,
|
|
91
|
+
why: `задача #${number} не объявляет эпика — в теле задачи под эпиком стоит строка «Задача эпика #<номер>»`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return { number: Number(declared), why: '' };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The makeup of the epic: the ordinal, the number of the task and what it is about, in the order of the plan. */
|
|
99
|
+
function makeupOf(plan) {
|
|
100
|
+
const key = new RegExp(`(?:#|${TASK_KEY}-)(\\d+)`);
|
|
101
|
+
const rows = [];
|
|
102
|
+
for (const line of planRows(plan).split('\n')) {
|
|
103
|
+
const cells = line
|
|
104
|
+
.split('|')
|
|
105
|
+
.slice(1, -1)
|
|
106
|
+
.map((cell) => cell.trim());
|
|
107
|
+
if (cells.length < 2 || cells.every((cell) => /^:?-+:?$/.test(cell))) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const found = cells.map((cell) => key.exec(cell)).find(Boolean);
|
|
112
|
+
if (found) {
|
|
113
|
+
rows.push({ order: cells[0], number: Number(found[1]), about: cells[cells.length - 1] });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return rows;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The name of a task without the key in front: the key stands in a column of its own. */
|
|
120
|
+
function nameOf(title) {
|
|
121
|
+
return String(title ?? '').replace(new RegExp(`^\\[${TASK_KEY}-\\d+\\]\\s*`), '');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* One row of the table filled from the hosting: the name of the task and the state cell.
|
|
126
|
+
*
|
|
127
|
+
* A task is counted finished by the same reading the cell is written by: merged, or handed over by
|
|
128
|
+
* a request. Waiting for a merge is not work — the executor has nothing left to do about it, and
|
|
129
|
+
* the work of the epic is over exactly at that minute.
|
|
130
|
+
*
|
|
131
|
+
* The run is asked by the head of the request, not by the branch: the list of the runs of a branch
|
|
132
|
+
* answers about the last commit that started one, and a green run of a commit gone by then reads as
|
|
133
|
+
* a green head.
|
|
134
|
+
*/
|
|
135
|
+
function rowOf(number, board, pulls) {
|
|
136
|
+
const issue = issueOf(number);
|
|
137
|
+
if (!issue) {
|
|
138
|
+
return { name: '—', state: 'не заведена', finished: false };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const name = nameOf(issue.title);
|
|
142
|
+
if (issue.state !== 'OPEN') {
|
|
143
|
+
return { name, state: 'влито', finished: true };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const pull = pulls.find((one) => numberFromTitle(String(one.title ?? '')) === number);
|
|
147
|
+
if (!pull) {
|
|
148
|
+
const column = board.items.get(number)?.status ?? null;
|
|
149
|
+
return { name, state: column ? `в очереди, столбец «${column}»` : 'заведена, столбца нет', finished: false };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const verdict = verdictOnHead(pull.headRefOid, OPTIONS);
|
|
153
|
+
const draft = pull.isDraft === true ? 'черновик' : 'готова к слиянию';
|
|
154
|
+
return { name, state: `заявка #${pull.number} ${draft}, прогон на вершине ${VERDICT[verdict] ?? verdict}`, finished: true };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Why the epic exists, in one sentence — the first phrase of the section the plan opens with.
|
|
159
|
+
*
|
|
160
|
+
* A plan whose first section is worded otherwise loses the phrase, and the paragraph then names
|
|
161
|
+
* only the count of the tasks: that is the open question `Q-WC-9` of the subdomain.
|
|
162
|
+
*/
|
|
163
|
+
function whyOf(plan) {
|
|
164
|
+
const section = /^##\s+Зачем\s*$/m.exec(plan);
|
|
165
|
+
if (!section) {
|
|
166
|
+
return '';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const rest =
|
|
170
|
+
plan
|
|
171
|
+
.slice(section.index + section[0].length)
|
|
172
|
+
.split(/\n\s*\n/)
|
|
173
|
+
.find((piece) => piece.trim() !== '') ?? '';
|
|
174
|
+
const sentence = rest.trim().replace(/\s+/g, ' ');
|
|
175
|
+
const end = sentence.indexOf('. ');
|
|
176
|
+
return end === -1 ? sentence : sentence.slice(0, end + 1);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** The paragraph above the table: an epic squeezed into columns loses what it is named for. */
|
|
180
|
+
function paragraphOf(epic, plan, rows) {
|
|
181
|
+
const running = rows.findIndex((row) => row.state !== 'влито');
|
|
182
|
+
const where = running === -1 ? 'все закрыты' : `идёт ${running + 1}`;
|
|
183
|
+
const why = whyOf(plan);
|
|
184
|
+
const tail = why === '' ? '' : ` — ${why}`;
|
|
185
|
+
return `**Эпик «${nameOf(epic.title)}» (${TASK_KEY}-${epic.number})**${tail} Задач ${rows.length}, ${where}.`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** The table itself: the ordinal, the name, the key, what it is about, the state. */
|
|
189
|
+
function tableOf(rows) {
|
|
190
|
+
const head = ['| № | Задача | Номер | О чём | Состояние |', '| --- | --- | --- | --- | --- |'];
|
|
191
|
+
const body = rows.map((row) => `| ${row.order} | ${row.name} | ${TASK_KEY}-${row.number} | ${row.about} | ${row.state} |`);
|
|
192
|
+
return [...head, ...body];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The epic, its plan and the rows filled from the hosting — or the reason there is nothing to
|
|
197
|
+
* assemble. Both answers of the command stand on this one reading: assembled twice, they would
|
|
198
|
+
* count a task finished differently.
|
|
199
|
+
*/
|
|
200
|
+
function gathered(argv) {
|
|
201
|
+
const asked = epicAsked(argv);
|
|
202
|
+
if (asked.number === null) {
|
|
203
|
+
return { ok: false, why: asked.why };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const epic = issueOf(asked.number);
|
|
207
|
+
if (!epic) {
|
|
208
|
+
return { ok: false, why: `у хостинга нет карточки эпика #${asked.number}` };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const found = planPathOf(epic.body);
|
|
212
|
+
if (found.path === null) {
|
|
213
|
+
return { ok: false, why: `карточка эпика #${asked.number}: ${found.why}` };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const plan = readFileSync(join(ROOT, found.path), 'utf8');
|
|
217
|
+
const rows = makeupOf(plan);
|
|
218
|
+
if (rows.length === 0) {
|
|
219
|
+
return { ok: false, why: `замысел «${found.path}» не несёт состава эпика: состав — таблица со столбцом задач` };
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const board = fetchBoard(OPTIONS);
|
|
223
|
+
const pulls = fetchOpenPulls(OPTIONS);
|
|
224
|
+
return { ok: true, why: '', epic, plan, rows: rows.map((row) => ({ ...row, ...rowOf(row.number, board, pulls) })) };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** The lines of the answer, or the refusal with the reason: the caller prints and ends. */
|
|
228
|
+
export function epicTable(argv) {
|
|
229
|
+
const found = gathered(argv);
|
|
230
|
+
if (!found.ok) {
|
|
231
|
+
return { ok: false, lines: [found.why] };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return { ok: true, lines: [paragraphOf(found.epic, found.plan, found.rows), '', ...tableOf(found.rows)] };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The numbers of the tasks of the epic that are not finished, one per line — the machine answer for
|
|
239
|
+
* the guard of the stop.
|
|
240
|
+
*
|
|
241
|
+
* It is a mode of this very command, not a reader of its own: a second reading of the same tasks
|
|
242
|
+
* would diverge from the printed table in silence, and the guard would refuse work the table calls
|
|
243
|
+
* unfinished. An empty answer with the zero code means the epic is over.
|
|
244
|
+
*/
|
|
245
|
+
export function unfinished(argv) {
|
|
246
|
+
const found = gathered(argv);
|
|
247
|
+
if (!found.ok) {
|
|
248
|
+
return { ok: false, lines: [found.why] };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return { ok: true, lines: found.rows.filter((row) => row.finished !== true).map((row) => String(row.number)) };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const isEntryPoint = process.argv[1] && import.meta.url === `file://${process.argv[1]}`;
|
|
255
|
+
|
|
256
|
+
if (isEntryPoint) {
|
|
257
|
+
const argv = process.argv.slice(2);
|
|
258
|
+
const asked = argv.filter((one) => one !== UNFINISHED);
|
|
259
|
+
let outcome;
|
|
260
|
+
try {
|
|
261
|
+
outcome = argv.includes(UNFINISHED) ? unfinished(asked) : epicTable(asked);
|
|
262
|
+
} catch (error) {
|
|
263
|
+
const why = error instanceof OfflineError ? error.message : String(error?.message ?? error);
|
|
264
|
+
outcome = { ok: false, lines: [`состояние спросить нечем: ${why}`, 'таблица не печатается: пустая читается как пустой эпик'] };
|
|
265
|
+
}
|
|
266
|
+
process.stdout.write(outcome.lines.length === 0 ? '' : `${outcome.lines.join('\n')}\n`);
|
|
267
|
+
process.exit(outcome.ok ? 0 : 1);
|
|
268
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
|
|
12
|
-
import { BOUNDARIES_DIR, FAMILIES, isDir,
|
|
12
|
+
import { BOUNDARIES_DIR, FAMILIES, isDir, libTag, report } from './lib-common.mjs';
|
|
13
13
|
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -29,7 +29,7 @@ function checkBoundaries(libs) {
|
|
|
29
29
|
const sources = files.map((name) => ({ name, text: readFileSync(join(ROOT, BOUNDARIES_DIR, name), 'utf8') }));
|
|
30
30
|
|
|
31
31
|
for (const libPath of libs) {
|
|
32
|
-
const tag =
|
|
32
|
+
const tag = libTag(libPath);
|
|
33
33
|
const declaration = `sourceTag: '${tag}'`;
|
|
34
34
|
const owners = sources.flatMap(({ name, text }) => {
|
|
35
35
|
const count = text.split(declaration).length - 1;
|
|
@@ -101,10 +101,52 @@ const isSingleLayerDomain = (path) => matches(pathsOf('singleLayerDomains'), pat
|
|
|
101
101
|
/** Paths the lib walk must skip */
|
|
102
102
|
const isIgnoredLib = (path) => isNotDomain(path) || isLegacyDomain(path) || isLegacyLib(path);
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The formula: what the name, the tag and the alias of a lib must become where the tree declared
|
|
106
|
+
* nothing. It is not the name itself — the name is what the tree wrote down. A tree that names its
|
|
107
|
+
* libs otherwise used to redden on flat ground, and the only way to silence that was the exceptions
|
|
108
|
+
* list.
|
|
109
|
+
*/
|
|
104
110
|
const projectName = (libPath) => libPath.replace(/^libs\//, '').replaceAll('/', '-');
|
|
105
111
|
const projectTag = (libPath) => `scope:${projectName(libPath)}`;
|
|
106
112
|
const importAlias = (libPath) => `${CONFIG.importScope}/${libPath.slice(`${LIBS_ROOT}/`.length)}`;
|
|
107
113
|
|
|
114
|
+
/** The name the lib declared in its manifest; an empty string when it declared none. */
|
|
115
|
+
function declaredName(libPath) {
|
|
116
|
+
if (!existsSync(join(ROOT, libPath, 'project.json'))) {
|
|
117
|
+
return '';
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
return String(readJson(`${libPath}/project.json`).name ?? '');
|
|
121
|
+
} catch {
|
|
122
|
+
// Unreadable JSON is the business of the manifest check, and it says so in its own words:
|
|
123
|
+
// here a refusal would take down the whole walk over the neighbouring libs as well.
|
|
124
|
+
return '';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** The name of the lib: the declared one, and the formula only where nothing is declared. */
|
|
129
|
+
const libName = (libPath) => declaredName(libPath) || projectName(libPath);
|
|
130
|
+
/** The tag of the lib: derived from its own name, not from its path. */
|
|
131
|
+
const libTag = (libPath) => `scope:${libName(libPath)}`;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The alias `tsconfig.base.json` points at this lib by. It is looked for by what it points at, not
|
|
135
|
+
* by its spelling: a lib is reachable by an alias or it is not, and how the tree spells the alias is
|
|
136
|
+
* the tree's own business. An empty string means no alias points here.
|
|
137
|
+
*/
|
|
138
|
+
function declaredAlias(libPath) {
|
|
139
|
+
const target = `./${libPath}/src/index.ts`;
|
|
140
|
+
let paths = {};
|
|
141
|
+
try {
|
|
142
|
+
paths = readJson('tsconfig.base.json').compilerOptions.paths ?? {};
|
|
143
|
+
} catch {
|
|
144
|
+
return '';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return Object.keys(paths).find((alias) => paths[alias]?.[0] === target) ?? '';
|
|
148
|
+
}
|
|
149
|
+
|
|
108
150
|
/**
|
|
109
151
|
* The files of a lib, except the barrel: an empty layer has a barrel just as a filled one does, and
|
|
110
152
|
* an empty layer cannot be told from a filled one by it.
|
|
@@ -157,5 +199,9 @@ export {
|
|
|
157
199
|
projectName,
|
|
158
200
|
projectTag,
|
|
159
201
|
importAlias,
|
|
202
|
+
declaredName,
|
|
203
|
+
declaredAlias,
|
|
204
|
+
libName,
|
|
205
|
+
libTag,
|
|
160
206
|
sourceCount,
|
|
161
207
|
};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { existsSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
|
|
12
|
-
import { LIB_PREFIX, REQUIRED_FILES, importAlias,
|
|
12
|
+
import { LIB_PREFIX, REQUIRED_FILES, declaredAlias, importAlias, libTag, projectName, readJson, report } from './lib-common.mjs';
|
|
13
13
|
import { ROOT } from './rt-kit-checks.config.mjs';
|
|
14
14
|
|
|
15
15
|
function checkLib(libPath, { requirePrefix = true } = {}) {
|
|
@@ -24,8 +24,11 @@ function checkLib(libPath, { requirePrefix = true } = {}) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const project = readJson(`${libPath}/project.json`);
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// The name the tree wrote down is the name. The formula speaks only where nothing is written:
|
|
28
|
+
// it says what the name must become, and judging a declared name by it reddens a lib that
|
|
29
|
+
// breaks nothing.
|
|
30
|
+
if (!project.name) {
|
|
31
|
+
report(libPath, `the manifest declares no project name, and by the path it must be «${projectName(libPath)}»`);
|
|
29
32
|
}
|
|
30
33
|
if (project.sourceRoot !== `${libPath}/src`) {
|
|
31
34
|
report(libPath, `sourceRoot «${project.sourceRoot}» does not match the path`);
|
|
@@ -38,23 +41,25 @@ function checkLib(libPath, { requirePrefix = true } = {}) {
|
|
|
38
41
|
report(libPath, `prefix «${project.prefix}» instead of the mandatory «${LIB_PREFIX}»`);
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
// One tag per lib stays mandatory — the linter boundaries are built on it — and the tag is
|
|
45
|
+
// judged against the lib's own name, not against its path.
|
|
41
46
|
const tags = project.tags ?? [];
|
|
42
47
|
if (tags.length !== 1) {
|
|
43
|
-
report(libPath, `tags ${tags.length}, and there must be exactly one: ${
|
|
44
|
-
} else if (tags[0] !==
|
|
45
|
-
report(libPath, `the tag «${tags[0]}» does not match the
|
|
48
|
+
report(libPath, `tags ${tags.length}, and there must be exactly one: ${libTag(libPath)}`);
|
|
49
|
+
} else if (tags[0] !== libTag(libPath)) {
|
|
50
|
+
report(libPath, `the tag «${tags[0]}» does not match the name of the lib, expected «${libTag(libPath)}»`);
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Every lib is reachable by an alias. Which alias is the tree's own business: it is looked for by
|
|
56
|
+
* what it points at, and its spelling is judged by nothing. A lib nothing points at is named
|
|
57
|
+
* together with the alias the formula would give it.
|
|
58
|
+
*/
|
|
49
59
|
function checkAliases(libs) {
|
|
50
|
-
const paths = readJson('tsconfig.base.json').compilerOptions.paths;
|
|
51
60
|
for (const libPath of libs) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!paths[alias]) {
|
|
55
|
-
report(libPath, `tsconfig.base.json has no alias ${alias}`);
|
|
56
|
-
} else if (paths[alias][0] !== target) {
|
|
57
|
-
report(libPath, `the alias ${alias} points at ${paths[alias][0]}, not at ${target}`);
|
|
61
|
+
if (declaredAlias(libPath) === '') {
|
|
62
|
+
report(libPath, `tsconfig.base.json names no alias pointing at ./${libPath}/src/index.ts, and by the path it must be ${importAlias(libPath)}`);
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -74,11 +74,29 @@ const DEFAULTS = {
|
|
|
74
74
|
* those it installs: a sign about ready-made code from a package the tree does not have
|
|
75
75
|
* answers falsely. Empty — there are no signs at all, and the guard and the check say so
|
|
76
76
|
* rather than stay silent.
|
|
77
|
+
*
|
|
78
|
+
* A bundle is named either by the name alone or by a pair of the name and the area of the tree
|
|
79
|
+
* it holds over: `{ "name": "ui-kit-v2", "roots": ["apps/admin"] }`. A tree with two sources of
|
|
80
|
+
* look judges each application by its own bundle; without an area it would have a single move —
|
|
81
|
+
* not to declare the bundle at all, and then nothing catches a bypass of the ready-made where
|
|
82
|
+
* the bundle does hold.
|
|
77
83
|
*/
|
|
78
84
|
reuse: { bundles: [], signals: '' },
|
|
79
85
|
/** Where the domain specs lie; empty — the tree has none, and the spec audit is not run. */
|
|
80
86
|
specsDir: 'docs/specs',
|
|
81
87
|
tasksDir: 'docs/tasks',
|
|
88
|
+
/**
|
|
89
|
+
* Where the plans of work wider than one task live: the plan of an epic and the plan of work
|
|
90
|
+
* that does not fit into one session lie side by side there.
|
|
91
|
+
*
|
|
92
|
+
* The creating command needs it, the audit does not: the audit takes the path to a plan from
|
|
93
|
+
* the body of the epic card, and that stays the only truth about an epic already created. This
|
|
94
|
+
* key says only where a new plan is put — a directory that has not been named refuses the
|
|
95
|
+
* creation of an epic instead of scattering plans across the tree.
|
|
96
|
+
*
|
|
97
|
+
* Empty — the tree has no such directory, and an epic is not created by the command.
|
|
98
|
+
*/
|
|
99
|
+
plansDir: '',
|
|
82
100
|
/** Where the lists of accepted debts are put. */
|
|
83
101
|
allowlistDir: 'tools',
|
|
84
102
|
/**
|
|
@@ -216,6 +234,7 @@ const DEFAULTS = {
|
|
|
216
234
|
*/
|
|
217
235
|
longWork: {
|
|
218
236
|
label: '',
|
|
237
|
+
/** Empty — the tree's `plansDir` is taken: one directory is not named twice. */
|
|
219
238
|
plansDir: '',
|
|
220
239
|
},
|
|
221
240
|
/** The work queue: the owner, the repository, the board and the machine account. */
|
|
@@ -38,14 +38,38 @@ function parseSignals(text) {
|
|
|
38
38
|
return JSON.parse(text.replace(/^#[^\n]*\n/, '')).signals ?? [];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The name of a bundle and the area of the tree it applies to.
|
|
43
|
+
*
|
|
44
|
+
* A bundle is declared either by the name alone or by a pair of the name and the area — a directory
|
|
45
|
+
* or a list of them. There is more than one source of look in a tree oftener than one: the owner
|
|
46
|
+
* panel is assembled from one set of ready-made code, the public site from another, and a sign of
|
|
47
|
+
* the first answers falsely over the second. Without an area such a tree has a single move — not to
|
|
48
|
+
* declare the bundle at all, and then nothing catches a bypass of the ready-made in the area where
|
|
49
|
+
* the bundle does hold. An area is not written for a tree with one source of look: an empty list
|
|
50
|
+
* means the whole tree, exactly as before.
|
|
51
|
+
*/
|
|
52
|
+
function bundleOf(declared) {
|
|
53
|
+
if (typeof declared === 'string') {
|
|
54
|
+
return { name: declared, roots: [] };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const roots = declared?.roots ?? [];
|
|
58
|
+
|
|
59
|
+
return { name: declared?.name, roots: typeof roots === 'string' ? [roots] : roots };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function readBundle(declared) {
|
|
63
|
+
const { name, roots } = bundleOf(declared);
|
|
64
|
+
const path = name ? join(BUNDLES_DIR, `${name}.json`) : '';
|
|
65
|
+
if (!path || !existsSync(path)) {
|
|
44
66
|
const known = bundleNames().join(', ') || 'none';
|
|
45
|
-
throw new Error(`the bundle of signs «${name}» is not found at the package; there are: ${known}`);
|
|
67
|
+
throw new Error(`the bundle of signs «${name ?? ''}» is not found at the package; there are: ${known}`);
|
|
46
68
|
}
|
|
47
69
|
|
|
48
|
-
|
|
70
|
+
// The area goes onto the sign, not next to it: further on the signs of all the bundles lie in
|
|
71
|
+
// one list, and by the sign alone there would be no telling which bundle it came from.
|
|
72
|
+
return parseSignals(readFileSync(path, 'utf8')).map((signal) => (roots.length > 0 ? { ...signal, roots } : signal));
|
|
49
73
|
}
|
|
50
74
|
|
|
51
75
|
/** A sign that looks for a native tag: `<input\\b`, `<textarea\\b`, `<select\\b`. */
|
|
@@ -109,6 +133,16 @@ export function withKitDirectives(signals, directives) {
|
|
|
109
133
|
*/
|
|
110
134
|
export function loadSignals(config, root) {
|
|
111
135
|
const declared = config.bundles ?? [];
|
|
136
|
+
const names = declared.map((one) => bundleOf(one).name);
|
|
137
|
+
const twice = names.find((name, index) => names.indexOf(name) !== index);
|
|
138
|
+
if (twice) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`the bundle of signs «${twice}» is declared twice. A bundle carries one area of the tree: ` +
|
|
141
|
+
`declared a second time, it takes the first declaration away silently, and the area named ` +
|
|
142
|
+
`there is left judged by nothing. Two areas of one bundle are written as one list of directories.`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
112
146
|
const signals = declared.flatMap(readBundle);
|
|
113
147
|
|
|
114
148
|
const ownPath = config.signals ? join(root, config.signals) : null;
|
|
@@ -13,7 +13,9 @@ import {
|
|
|
13
13
|
VERDICT,
|
|
14
14
|
VERDICT_MIN,
|
|
15
15
|
bulletsOf,
|
|
16
|
+
codeOf,
|
|
16
17
|
exists,
|
|
18
|
+
isTestFile,
|
|
17
19
|
read,
|
|
18
20
|
report,
|
|
19
21
|
sectionOf,
|
|
@@ -203,7 +205,6 @@ function checkRuleImplementation(specFile, text, mapFile, heading = ['## Rules',
|
|
|
203
205
|
* Code without comments. A symbol named in an explanation is called by nobody, and dead code
|
|
204
206
|
* usually has more explanations than live code does.
|
|
205
207
|
*/
|
|
206
|
-
const codeOf = (text) => text.replace(/\/\*[\s\S]*?\*\//g, ' ').replace(/(^|[^:`'"])\/\/.*$/gm, '$1');
|
|
207
208
|
|
|
208
209
|
const DECLARATION_MODIFIERS = '(?:export|declare|abstract|public|private|protected|static|readonly|override|async|accessor)';
|
|
209
210
|
|
|
@@ -257,6 +258,36 @@ function symbolOwners() {
|
|
|
257
258
|
return owners;
|
|
258
259
|
}
|
|
259
260
|
|
|
261
|
+
/**
|
|
262
|
+
* The files a package publishes outward: everything a `public-api.ts` or an `index.ts` re-exports,
|
|
263
|
+
* and everything those files re-export in turn. A symbol of a published file is called by whoever
|
|
264
|
+
* installed the package, and that caller is not in this tree at all: judged by the calls visible
|
|
265
|
+
* here, the whole public API of a kit reads as dead code.
|
|
266
|
+
*/
|
|
267
|
+
function publishedFiles() {
|
|
268
|
+
const published = new Set();
|
|
269
|
+
const entries = SOURCE_ROOTS.flatMap((root) => walk(root, (name) => name === 'public-api.ts' || name === 'index.ts'));
|
|
270
|
+
const queue = [...entries];
|
|
271
|
+
while (queue.length) {
|
|
272
|
+
const file = queue.pop();
|
|
273
|
+
const dir = file.slice(0, file.lastIndexOf('/'));
|
|
274
|
+
for (const [, relative] of read(file).matchAll(/(?:export|import)[^'"]*from\s+['"](\.[^'"]*)['"]/g)) {
|
|
275
|
+
for (const suffix of ['.ts', '/index.ts', '']) {
|
|
276
|
+
const path = `${dir}/${relative.replace(/^\.\//, '')}${suffix}`.replace(/\/\.\//g, '/');
|
|
277
|
+
if (exists(path) && !published.has(path)) {
|
|
278
|
+
published.add(path);
|
|
279
|
+
if (path.endsWith('/index.ts')) {
|
|
280
|
+
queue.push(path);
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return published;
|
|
289
|
+
}
|
|
290
|
+
|
|
260
291
|
/**
|
|
261
292
|
* A symbol declared in its own file and met nowhere else carries nothing out: a rule bound
|
|
262
293
|
* to it describes an intention.
|
|
@@ -277,6 +308,7 @@ function checkTracedAnchors() {
|
|
|
277
308
|
}
|
|
278
309
|
|
|
279
310
|
const owners = symbolOwners();
|
|
311
|
+
const published = publishedFiles();
|
|
280
312
|
for (const { mapFile, path, symbol } of declared) {
|
|
281
313
|
// A word boundary is placed only where one exists: there is none before a hash, and a
|
|
282
314
|
// pattern with it would give zero occurrences for every private name.
|
|
@@ -284,12 +316,24 @@ function checkTracedAnchors() {
|
|
|
284
316
|
? `${escapeForRegExp(symbol)}\\b`
|
|
285
317
|
: `\\b${escapeForRegExp(symbol)}\\b`;
|
|
286
318
|
const here = (codeAt(path).match(new RegExp(bound, 'g')) || []).length;
|
|
287
|
-
|
|
319
|
+
// A test is not a call. A function written test-first and never called from the
|
|
320
|
+
// application is an intention: the test calls it itself, and by that call a live symbol
|
|
321
|
+
// cannot be told from a forgotten one. Counted together, the declaration and the test file
|
|
322
|
+
// next to it made two — the threshold — and the audit went green exactly when the binding
|
|
323
|
+
// lied hardest.
|
|
324
|
+
// The exclusion works only for a symbol declared in the code of the application. A helper
|
|
325
|
+
// declared in the suite harness itself is called by tests by its very purpose: judged by
|
|
326
|
+
// the same measure, the articles of the testing rule would all turn red at once.
|
|
327
|
+
const others = [...(owners.get(symbol) || [])].filter((file) => file !== path);
|
|
328
|
+
const elsewhere = isTestFile(path) || published.has(path) ? others.length : others.filter((file) => !isTestFile(file)).length;
|
|
288
329
|
if (here + elsewhere < 2) {
|
|
289
330
|
report(
|
|
290
331
|
mapFile,
|
|
291
|
-
|
|
292
|
-
|
|
332
|
+
others.length > elsewhere
|
|
333
|
+
? `the binding leads into code called by a test alone: \`${symbol}\` is declared in \`${path}\` and outside tests is met nowhere — ` +
|
|
334
|
+
'a test is not a call from the application; either the statement is carried out elsewhere, or its place is in «Open questions» of the law as Q-<letter>-<number>'
|
|
335
|
+
: `the binding leads into dead code: \`${symbol}\` is declared in \`${path}\` and met nowhere else — ` +
|
|
336
|
+
'either the statement is carried out elsewhere, or its place is in «Open questions» of the law as Q-<letter>-<number>'
|
|
293
337
|
);
|
|
294
338
|
}
|
|
295
339
|
}
|