@roomi-fields/grillhouse 0.32.0 → 0.33.1
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +32 -0
- package/bin/grillhouse.mjs +6 -4
- package/cadre/templates/projet/.github/workflows/ci.yml +169 -16
- package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +8 -5
- package/dist/temporal/circuit/client.d.ts +10 -3
- package/dist/temporal/circuit/client.js +8 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +25 -0
- package/dist/temporal/circuit/contrat.js +31 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +67 -38
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +13 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -0
- package/dist/temporal/deroules.js +3 -1
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -0
- package/dist/temporal/file/activites.js +5 -2
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +50 -33
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +3 -1
- package/dist/temporal/file/deroule.js +128 -26
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -1
- package/dist/temporal/installation.js +57 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +10 -0
- package/dist/temporal/nuits/activites.js +114 -0
- package/dist/temporal/nuits/activites.js.map +1 -0
- package/dist/temporal/nuits/appel.d.ts +23 -0
- package/dist/temporal/nuits/appel.js +40 -0
- package/dist/temporal/nuits/appel.js.map +1 -0
- package/dist/temporal/nuits/choix.d.ts +14 -0
- package/dist/temporal/nuits/choix.js +119 -0
- package/dist/temporal/nuits/choix.js.map +1 -0
- package/dist/temporal/nuits/client.d.ts +28 -0
- package/dist/temporal/nuits/client.js +83 -0
- package/dist/temporal/nuits/client.js.map +1 -0
- package/dist/temporal/nuits/commande.d.ts +2 -0
- package/dist/temporal/nuits/commande.js +107 -0
- package/dist/temporal/nuits/commande.js.map +1 -0
- package/dist/temporal/nuits/contrat.d.ts +98 -0
- package/dist/temporal/nuits/contrat.js +30 -0
- package/dist/temporal/nuits/contrat.js.map +1 -0
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +100 -0
- package/dist/temporal/nuits/deroule.js.map +1 -0
- package/dist/temporal/travailleur.js +4 -1
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +214 -49
- package/docs/CADRE.md +31 -1
- package/docs/INTERFACE.md +47 -7
- package/hooks/register.tsx +11 -3
- package/package.json +4 -1
- package/scripts/abi-des-dependances.mjs +105 -0
- package/scripts/activites.mjs +113 -42
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/avancement.mjs +8 -18
- package/scripts/ci-des-branches.mjs +91 -0
- package/scripts/circuit.mjs +79 -4
- package/scripts/circuits-du-serveur.mjs +4 -3
- package/scripts/composants-affectes.mjs +24 -7
- package/scripts/composition-des-langages.mjs +3 -0
- package/scripts/crochets.mjs +4 -0
- package/scripts/dernier-vert.mjs +31 -10
- package/scripts/enveloppe/enveloppe.mjs +3 -1
- package/scripts/enveloppe/lancer.sh +1 -1
- package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
- package/scripts/etapes.mjs +18 -1
- package/scripts/faits-du-circuit.mjs +43 -20
- package/scripts/fichier-du-poste.mjs +87 -0
- package/scripts/grillhouse-maj.mjs +15 -1
- package/scripts/integration/file.mjs +215 -275
- package/scripts/integration/integrer.mjs +82 -41
- package/scripts/integration/rejeu.mjs +13 -64
- package/scripts/jointure.d.ts +26 -2
- package/scripts/langages/cargo/commandes.mjs +81 -19
- package/scripts/langages/cargo/exemples.mjs +2 -2
- package/scripts/langages/cargo/index.mjs +11 -5
- package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
- package/scripts/langages/python/commandes.mjs +11 -7
- package/scripts/langages/python/exemples.mjs +1 -1
- package/scripts/langages/python/index.mjs +9 -2
- package/scripts/langages/python/tailles-des-tests.mjs +19 -11
- package/scripts/langages/typescript/code-mort.mjs +41 -24
- package/scripts/langages/typescript/consommateurs.mjs +28 -17
- package/scripts/langages/typescript/exemples.mjs +2 -0
- package/scripts/langages/typescript/index.mjs +22 -3
- package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
- package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
- package/scripts/langages/typescript/resumes.mjs +17 -7
- package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
- package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
- package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
- package/scripts/langages/typescript/tests.mjs +8 -2
- package/scripts/langages/typescript/tranches.mjs +273 -0
- package/scripts/langages/typescript/verifier.mjs +140 -31
- package/scripts/langages/typescript/vitest-config/changements.mjs +23 -11
- package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
- package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
- package/scripts/lint-des-scripts.mjs +23 -6
- package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
- package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
- package/scripts/migrations/0.33.0-node-26.mjs +58 -0
- package/scripts/migrations.mjs +8 -0
- package/scripts/newday.mjs +18 -0
- package/scripts/nuit.sh +35 -17
- package/scripts/registre.d.mts +90 -0
- package/scripts/registre.mjs +28 -3
- package/scripts/reprise.mjs +12 -8
- package/scripts/services-du-noyau.mjs +5 -1
- package/scripts/session-start.sh +40 -32
- package/scripts/sous-commandes.mjs +29 -10
- package/scripts/superviseur.mjs +72 -27
- package/scripts/tableau.mjs +129 -20
- package/scripts/taches-du-graphe.mjs +39 -6
- package/scripts/transitions.mjs +42 -3
- package/scripts/verrou-de-machine.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +75 -0
- package/skills/grill/SKILL.md +8 -6
- package/skills/pitmaster/SKILL.md +15 -9
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
// (./composants.mjs).
|
|
18
18
|
// - The elements of a lot, one per crate (./elements-du-lot.mjs).
|
|
19
19
|
// - The commands `tester` (the crates' tasks of Turborepo), `tests-du-paquet` (the body of a crate's
|
|
20
|
-
// task), `verifier`, `typer
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
// budget benches `tests/*_budget.rs`, which the day leaves out);
|
|
20
|
+
// task), `verifier`, `typer` and `tests-de-nuit` (./commandes.mjs), each described, `{ script,
|
|
21
|
+
// args }`, never run, `tests-de-nuit` played by the night (the test targets `tests/*_nuit.rs`,
|
|
22
|
+
// then the time budget benches `tests/*_budget.rs`, which the day leaves out);
|
|
24
23
|
// the verdict of a run (./verdict.mjs). The tool of a test's temporary directory, the crate
|
|
25
24
|
// `tempfile`, and its guard: `tests-du-paquet` and `verifier` play under a base of their pass, named in
|
|
26
25
|
// TMPDIR, TMP and TEMP, and fail naming what the tests left there (./commandes.mjs).
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
import { readFileSync } from 'node:fs';
|
|
39
38
|
import path from 'node:path';
|
|
40
39
|
import { fileURLToPath } from 'node:url';
|
|
41
|
-
import { empreintesDesTaches } from '../../services-du-noyau.mjs';
|
|
40
|
+
import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
|
|
42
41
|
import { commandes, fichierHorsDuJour, GARDES } from './commandes.mjs';
|
|
43
42
|
import {
|
|
44
43
|
composantDans,
|
|
@@ -126,6 +125,13 @@ export default {
|
|
|
126
125
|
elementsDuLot,
|
|
127
126
|
// The hashes of the inputs of the tests tasks of the crates and their dependents, as
|
|
128
127
|
// Turborepo plans them.
|
|
128
|
+
// The remote cache of Turborepo on the poste: its server, its team, its token and the key of its
|
|
129
|
+
// signature in ~/.config/grillhouse/turbo-cache.env, read alone, never written from the poste.
|
|
130
|
+
environnementDuPoste: env =>
|
|
131
|
+
avecLeFichierDuPoste(env, {
|
|
132
|
+
fichier: 'turbo-cache.env',
|
|
133
|
+
ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
|
|
134
|
+
}),
|
|
129
135
|
empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
|
|
130
136
|
commandes,
|
|
131
137
|
verdict,
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
31
31
|
import path from 'node:path';
|
|
32
32
|
import { pathToFileURL } from 'node:url';
|
|
33
|
-
import { trancher } from '../../dette.mjs';
|
|
33
|
+
import { MODE, trancher } from '../../dette.mjs';
|
|
34
34
|
import { horsDuJour } from './commandes.mjs';
|
|
35
35
|
import { crates, unitaire } from './composants.mjs';
|
|
36
36
|
|
|
@@ -177,19 +177,27 @@ export function verifier(racine) {
|
|
|
177
177
|
}));
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
// The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
|
|
181
|
+
// prefixed with `⛔`, then the debt's lines, then the count of each size), and `code`, its exit code
|
|
182
|
+
// (1 on a refusal). The functional core of the command: it reads the repository and the project's
|
|
183
|
+
// debt and writes nothing to the standard streams; the command below is its shell. The refusals
|
|
184
|
+
// reach SARIF through `trancher` under the results directory <env> names (scripts/resultats.mjs);
|
|
185
|
+
// without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
186
|
+
export function rapport(racine, env = process.env) {
|
|
182
187
|
const toutes = tailles(racine);
|
|
183
188
|
const compte = t => toutes.filter(x => x.taille === t).length;
|
|
184
|
-
const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
const { refus, lignes } = trancher(racine, GARDE, verifier(racine), env[MODE] || undefined, env);
|
|
190
|
+
const resume = `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit ou de banc.`;
|
|
191
|
+
return {
|
|
192
|
+
lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes, resume],
|
|
193
|
+
code: refus.length ? 1 : 0,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
198
|
+
const { lignes, code } = rapport(process.cwd());
|
|
188
199
|
for (const l of lignes) {
|
|
189
200
|
process.stderr.write(`${l}\n`);
|
|
190
201
|
}
|
|
191
|
-
process.
|
|
192
|
-
`ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit ou de banc.\n`
|
|
193
|
-
);
|
|
194
|
-
process.exitCode = refus.length ? 1 : 0;
|
|
202
|
+
process.exitCode = code;
|
|
195
203
|
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
// npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
|
|
8
8
|
// npx grillhouse verifier [--tout | --gardes] verifier
|
|
9
9
|
// node commandes.mjs typer typer
|
|
10
|
-
// npx grillhouse preparer preparer
|
|
11
10
|
// npx grillhouse tests-de-nuit tests-de-nuit
|
|
12
11
|
// npx grillhouse tailles-des-tests | index-interfaces each guard, its own script
|
|
13
12
|
//
|
|
@@ -52,7 +51,7 @@
|
|
|
52
51
|
// the guards alone: the project's root scripts `grillhouse:gardes` then `gardes` the package.json
|
|
53
52
|
// holds.
|
|
54
53
|
// - `typer`: `uv run --locked python -m compileall`, the folders whose name begins with a dot (the
|
|
55
|
-
// `.venv`) left out.
|
|
54
|
+
// `.venv`) left out.
|
|
56
55
|
// - `tests-de-nuit`: pytest on the night tests of each package that holds some; none, nothing
|
|
57
56
|
// plays and the code is 0. The night (scripts/nuit.sh) runs it.
|
|
58
57
|
// - `construire --echec <fichier> <plan>` is the launcher's build of the copy
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
// (`construireDepuisLesArguments` of scripts/taches-du-graphe.mjs): the plan and its providers by
|
|
61
60
|
// `turbo run build --filter=<paquet>…`. `construire <chemin>` syncs one project, as the script
|
|
62
61
|
// `build` of its package.
|
|
63
|
-
// - `tests-du-paquet`, `tests-de-nuit`, `verifier
|
|
62
|
+
// - `tests-du-paquet`, `tests-de-nuit`, `verifier` and `typer` play under a temporary
|
|
64
63
|
// directory of their pass, the guard of the temporary directory: a base (`ouvrirBase` of ./jointure) named in TMPDIR, TMP and TEMP, removed at the
|
|
65
64
|
// end of the pass, green, red or interrupted; what the tests left there fails the pass (code 1),
|
|
66
65
|
// each name written on the error stream, the lock files uv takes there (`uv-<hash>.lock`) apart,
|
|
@@ -94,6 +93,7 @@ import {
|
|
|
94
93
|
cheminsDeLaTache,
|
|
95
94
|
construireDepuisLesArguments,
|
|
96
95
|
GRAPHE_JOUE,
|
|
96
|
+
joueCeQuiNeSeDivisePas,
|
|
97
97
|
lancerLesTaches,
|
|
98
98
|
ligneDesRestes,
|
|
99
99
|
nomDuPaquet,
|
|
@@ -121,7 +121,6 @@ export const NOMS = [
|
|
|
121
121
|
'verifier',
|
|
122
122
|
'typer',
|
|
123
123
|
'construire',
|
|
124
|
-
'preparer',
|
|
125
124
|
'tests-de-nuit',
|
|
126
125
|
];
|
|
127
126
|
// The task runner of the graph of the packages.
|
|
@@ -380,7 +379,7 @@ function testsDuPaquet(racine, args, env) {
|
|
|
380
379
|
return 2;
|
|
381
380
|
}
|
|
382
381
|
const dossierDe = abs => composantDans(tous, racine, abs)?.dossier ?? null;
|
|
383
|
-
const { chemins, options } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
|
|
382
|
+
const { chemins, options, tranche } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
|
|
384
383
|
const r = choisir(racine, tous, chemins);
|
|
385
384
|
if (r.refus) {
|
|
386
385
|
for (const l of r.refus) {
|
|
@@ -388,6 +387,11 @@ function testsDuPaquet(racine, args, env) {
|
|
|
388
387
|
}
|
|
389
388
|
return 2;
|
|
390
389
|
}
|
|
390
|
+
// pytest has no split of its own: a tranche past the first plays none of its tests, the first
|
|
391
|
+
// plays them all, so the n tranches together play each test once.
|
|
392
|
+
if (!joueCeQuiNeSeDivisePas(tranche)) {
|
|
393
|
+
return 0;
|
|
394
|
+
}
|
|
391
395
|
const p = passe(racine, env);
|
|
392
396
|
jouerLesTests(p, r.choix, [...args.filter(a => a.startsWith('-')), ...options]);
|
|
393
397
|
return p.code();
|
|
@@ -528,9 +532,9 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
|
|
|
528
532
|
if (nom === 'construire' && args.includes('--echec')) {
|
|
529
533
|
return construireDepuisLesArguments(OUTIL, args, racine);
|
|
530
534
|
}
|
|
531
|
-
if (nom === 'typer' || nom === '
|
|
535
|
+
if (nom === 'typer' || nom === 'construire') {
|
|
532
536
|
// `construire` and `typer` with a path: the one project of that folder, as Turborepo's task of
|
|
533
|
-
// one package; `typer` alone types them all
|
|
537
|
+
// one package; `typer` alone types them all.
|
|
534
538
|
let choisis = composants(racine);
|
|
535
539
|
if (nom === 'construire' || (nom === 'typer' && args.length)) {
|
|
536
540
|
const [chemin, ...autres] = args;
|
|
@@ -169,7 +169,7 @@ export default {
|
|
|
169
169
|
attendu: ['absent : sans fournisseur'],
|
|
170
170
|
},
|
|
171
171
|
commandes: {
|
|
172
|
-
valide: ['tester', 'verifier', 'typer', '
|
|
172
|
+
valide: ['tester', 'verifier', 'typer', 'tests-de-nuit', 'index-interfaces'],
|
|
173
173
|
invalide: ['tester', 'deployer'],
|
|
174
174
|
attendu: ['deployer : absente'],
|
|
175
175
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// readers, the entries of the index of the interfaces (./composants.mjs); the elements of a lot
|
|
22
22
|
// (./lot.mjs).
|
|
23
23
|
// - The commands `tester` (the projects' tasks of Turborepo), `tests-du-paquet` (the body of a
|
|
24
|
-
// project's task), `verifier`, `typer
|
|
24
|
+
// project's task), `verifier`, `typer` and `tests-de-nuit` (./commandes.mjs),
|
|
25
25
|
// each described, never run, and the verdict of a run (./verdict.mjs); the guard of the sizes of
|
|
26
26
|
// the tests (./tailles-des-tests.mjs) and the index of the interfaces up to date, each a command
|
|
27
27
|
// by its name too. The generated file, the index of the interfaces (./index-interfaces.mjs), its
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
import { readFileSync } from 'node:fs';
|
|
34
34
|
import path from 'node:path';
|
|
35
35
|
import { fileURLToPath } from 'node:url';
|
|
36
|
-
import { empreintesDesTaches } from '../../services-du-noyau.mjs';
|
|
36
|
+
import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
|
|
37
37
|
import { commandes, GARDES, PYCACHE } from './commandes.mjs';
|
|
38
38
|
import {
|
|
39
39
|
composantDans,
|
|
@@ -93,6 +93,13 @@ export default {
|
|
|
93
93
|
elementsDuLot,
|
|
94
94
|
// The hashes of the inputs of the tests tasks of the projects and their dependents, as
|
|
95
95
|
// Turborepo plans them.
|
|
96
|
+
// The remote cache of Turborepo on the poste: its server, its team, its token and the key of its
|
|
97
|
+
// signature in ~/.config/grillhouse/turbo-cache.env, read alone, never written from the poste.
|
|
98
|
+
environnementDuPoste: env =>
|
|
99
|
+
avecLeFichierDuPoste(env, {
|
|
100
|
+
fichier: 'turbo-cache.env',
|
|
101
|
+
ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
|
|
102
|
+
}),
|
|
96
103
|
empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
|
|
97
104
|
commandes,
|
|
98
105
|
verdict,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { existsSync, readFileSync } from 'node:fs';
|
|
21
21
|
import path from 'node:path';
|
|
22
22
|
import { pathToFileURL } from 'node:url';
|
|
23
|
-
import { trancher } from '../../dette.mjs';
|
|
23
|
+
import { MODE, trancher } from '../../dette.mjs';
|
|
24
24
|
import { composants, estDeNuit, fichiersDeTest } from './composants.mjs';
|
|
25
25
|
|
|
26
26
|
// The name of its findings and of its debt, apart from the module typescript's guard of the same
|
|
@@ -84,19 +84,27 @@ export function verifier(racine) {
|
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
// The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
|
|
88
|
+
// prefixed with `⛔`, then the debt's lines, then the count of each size), and `code`, its exit code
|
|
89
|
+
// (1 on a refusal). The functional core of the command: it reads the repository and the project's
|
|
90
|
+
// debt and writes nothing to the standard streams; the command below is its shell. The refusals
|
|
91
|
+
// reach SARIF through `trancher` under the results directory <env> names (scripts/resultats.mjs);
|
|
92
|
+
// without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
93
|
+
export function rapport(racine, env = process.env) {
|
|
89
94
|
const toutes = tailles(racine);
|
|
90
95
|
const compte = t => toutes.filter(x => x.taille === t).length;
|
|
91
|
-
const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
const { refus, lignes } = trancher(racine, GARDE, verifier(racine), env[MODE] || undefined, env);
|
|
97
|
+
const resume = `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit.`;
|
|
98
|
+
return {
|
|
99
|
+
lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes, resume],
|
|
100
|
+
code: refus.length ? 1 : 0,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
105
|
+
const { lignes, code } = rapport(process.cwd());
|
|
95
106
|
for (const l of lignes) {
|
|
96
107
|
process.stderr.write(`${l}\n`);
|
|
97
108
|
}
|
|
98
|
-
process.
|
|
99
|
-
`ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit.\n`
|
|
100
|
-
);
|
|
101
|
-
process.exitCode = refus.length ? 1 : 0;
|
|
109
|
+
process.exitCode = code;
|
|
102
110
|
}
|
|
@@ -43,7 +43,7 @@ import { tmpdir } from 'node:os';
|
|
|
43
43
|
import path from 'node:path';
|
|
44
44
|
import { pathToFileURL } from 'node:url';
|
|
45
45
|
import { horsCadre } from '../../paquets.mjs';
|
|
46
|
-
import { trancher } from '../../dette.mjs';
|
|
46
|
+
import { MODE, trancher } from '../../dette.mjs';
|
|
47
47
|
import { isTestFile } from './regle-des-tests.mjs';
|
|
48
48
|
|
|
49
49
|
const GENRES = {
|
|
@@ -280,9 +280,9 @@ function reglagesDependances(knipLu, racine, config, fichiers, paquets) {
|
|
|
280
280
|
return { ...r, entry: entryRacine, workspaces: espaces };
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
// Runs knip on <config> (knip's defaults when null), restricted to <include> when
|
|
284
|
-
// spawn result.
|
|
285
|
-
function knip(config, include) {
|
|
283
|
+
// Runs knip in <racine> on <config> (knip's defaults when null), restricted to <include> when
|
|
284
|
+
// given; the spawn result.
|
|
285
|
+
function knip(racine, config, include) {
|
|
286
286
|
const args = ['--no-install', 'knip', '--reporter', 'json', '--no-progress'];
|
|
287
287
|
if (include) {
|
|
288
288
|
args.push('--include', include);
|
|
@@ -295,7 +295,7 @@ function knip(config, include) {
|
|
|
295
295
|
writeFileSync(f, JSON.stringify(config));
|
|
296
296
|
args.push('--config', f);
|
|
297
297
|
}
|
|
298
|
-
return spawnSync('npx', args, { encoding: 'utf8' });
|
|
298
|
+
return spawnSync('npx', args, { cwd: racine, encoding: 'utf8' });
|
|
299
299
|
} finally {
|
|
300
300
|
if (tmp) {
|
|
301
301
|
rmSync(tmp, { recursive: true, force: true });
|
|
@@ -303,8 +303,14 @@ function knip(config, include) {
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
// The
|
|
307
|
-
|
|
306
|
+
// The report of the dead-code check at <racine>: `lignes`, what the command writes on stderr (each
|
|
307
|
+
// refusal and the debt's lines), and `code`, its exit code (1 on a refusal or a knip it cannot
|
|
308
|
+
// read). The functional core of the command: it runs knip and git and reads the project's debt, and
|
|
309
|
+
// writes nothing to the standard streams; the command below is its shell. The refusals reach SARIF
|
|
310
|
+
// through `trancher` under the results directory <env> names (scripts/resultats.mjs); without it none
|
|
311
|
+
// is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
312
|
+
export async function codeMort(racine, env = process.env) {
|
|
313
|
+
const lignes = [];
|
|
308
314
|
const hors = reglages(racine);
|
|
309
315
|
const fichierKnip = path.join(racine, 'knip.json');
|
|
310
316
|
const config =
|
|
@@ -312,20 +318,21 @@ async function codeMort(racine) {
|
|
|
312
318
|
const DEPS = ['dependencies', 'devDependencies'];
|
|
313
319
|
const { fichiers, dossiers, erreur } = fichiersTests(racine);
|
|
314
320
|
if (erreur) {
|
|
315
|
-
|
|
316
|
-
return 1;
|
|
321
|
+
lignes.push(`⛔ CODE MORT — git n'a pas listé les fichiers de test :\n${erreur}`);
|
|
322
|
+
return { lignes, code: 1 };
|
|
317
323
|
}
|
|
318
324
|
const knipLu = await knipDuDepot(racine);
|
|
319
325
|
if (!knipLu) {
|
|
320
|
-
|
|
321
|
-
'⛔ CODE MORT — knip du dépôt illisible : son matcher (picomatch), son ordre des clés (byPathDepth) ou son schéma des espaces manque
|
|
326
|
+
lignes.push(
|
|
327
|
+
'⛔ CODE MORT — knip du dépôt illisible : son matcher (picomatch), son ordre des clés (byPathDepth) ou son schéma des espaces manque.'
|
|
322
328
|
);
|
|
323
|
-
return 1;
|
|
329
|
+
return { lignes, code: 1 };
|
|
324
330
|
}
|
|
325
|
-
const premier = knip(hors ?? config);
|
|
331
|
+
const premier = knip(racine, hors ?? config);
|
|
326
332
|
const c1 = constats(premier.stdout ?? '');
|
|
327
333
|
const second = fichiers.length
|
|
328
334
|
? knip(
|
|
335
|
+
racine,
|
|
329
336
|
reglagesDependances(
|
|
330
337
|
knipLu,
|
|
331
338
|
racine,
|
|
@@ -346,26 +353,36 @@ async function codeMort(racine) {
|
|
|
346
353
|
}
|
|
347
354
|
if (c === null) {
|
|
348
355
|
const r = c1 ? second : premier;
|
|
349
|
-
|
|
350
|
-
`⛔ CODE MORT — knip n'a rien mesuré :\n${(r.stderr || r.stdout || '').slice(0, 1000)}
|
|
356
|
+
lignes.push(
|
|
357
|
+
`⛔ CODE MORT — knip n'a rien mesuré :\n${(r.stderr || r.stdout || '').slice(0, 1000)}`
|
|
351
358
|
);
|
|
352
|
-
return 1;
|
|
359
|
+
return { lignes, code: 1 };
|
|
353
360
|
}
|
|
354
|
-
const { refus, lignes } = trancher(
|
|
361
|
+
const { refus, lignes: lignesDette } = trancher(
|
|
362
|
+
racine,
|
|
363
|
+
'code-mort',
|
|
364
|
+
c,
|
|
365
|
+
env[MODE] || undefined,
|
|
366
|
+
env
|
|
367
|
+
);
|
|
355
368
|
if (refus.length) {
|
|
356
|
-
|
|
357
|
-
`⛔ CODE MORT — ${refus.length} constat(s) : chacun se supprime, ou sort par son nom dans knip.json avec sa raison
|
|
369
|
+
lignes.push(
|
|
370
|
+
`⛔ CODE MORT — ${refus.length} constat(s) : chacun se supprime, ou sort par son nom dans knip.json avec sa raison.`
|
|
358
371
|
);
|
|
359
372
|
for (const x of refus) {
|
|
360
|
-
|
|
373
|
+
lignes.push(` ${x.message}`);
|
|
361
374
|
}
|
|
362
375
|
}
|
|
363
|
-
for (const l of
|
|
364
|
-
|
|
376
|
+
for (const l of lignesDette) {
|
|
377
|
+
lignes.push(l);
|
|
365
378
|
}
|
|
366
|
-
return refus.length ? 1 : 0;
|
|
379
|
+
return { lignes, code: refus.length ? 1 : 0 };
|
|
367
380
|
}
|
|
368
381
|
|
|
369
382
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
370
|
-
|
|
383
|
+
const { lignes, code } = await codeMort(process.cwd());
|
|
384
|
+
for (const l of lignes) {
|
|
385
|
+
process.stderr.write(`${l}\n`);
|
|
386
|
+
}
|
|
387
|
+
process.exitCode = code;
|
|
371
388
|
}
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
import { existsSync, readFileSync } from 'node:fs';
|
|
47
47
|
import path from 'node:path';
|
|
48
48
|
import { pathToFileURL } from 'node:url';
|
|
49
|
-
import { trancher } from '../../dette.mjs';
|
|
49
|
+
import { MODE, trancher } from '../../dette.mjs';
|
|
50
50
|
import { horsCadre } from '../../paquets.mjs';
|
|
51
51
|
import { composants, dossiers, matieres } from './composants.mjs';
|
|
52
52
|
import { lireSiPresent, parcourir } from './parcours.mjs';
|
|
@@ -314,27 +314,38 @@ export function verifier(racine) {
|
|
|
314
314
|
return { refus };
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
317
|
+
// The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
|
|
318
|
+
// prefixed with `⛔`, the debt's lines, then the guidance that fits the kinds of refusal left), and
|
|
319
|
+
// `code`, its exit code (1 on a refusal). The functional core of the command: it reads the
|
|
320
|
+
// repository and the project's debt and writes nothing to the standard streams; the command below is
|
|
321
|
+
// its shell. The refusals reach SARIF through `trancher` under the results directory <env> names
|
|
322
|
+
// (scripts/resultats.mjs); without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
323
|
+
export function rapport(racine, env = process.env) {
|
|
324
|
+
const { refus, lignes } = trancher(
|
|
325
|
+
racine,
|
|
326
|
+
'consommateurs',
|
|
327
|
+
verifier(racine).refus,
|
|
328
|
+
env[MODE] || undefined,
|
|
329
|
+
env
|
|
330
|
+
);
|
|
331
|
+
const sorties = [...refus.map(r => `⛔ ${r.message}`), ...lignes];
|
|
327
332
|
if (refus.some(r => r.regle !== DECLARE_NON_UTILISE && r.regle !== LIGNE_MAL_FORMEE)) {
|
|
328
|
-
|
|
329
|
-
"Une consommation nouvelle se décide (le titre du ticket, sa section « Architecture » ou sa section « Noms publiés » qui la nomment, sinon l'arbitrage du superviseur), puis entre dans la section « Consommateurs » de l'interface du fournisseur
|
|
333
|
+
sorties.push(
|
|
334
|
+
"Une consommation nouvelle se décide (le titre du ticket, sa section « Architecture » ou sa section « Noms publiés » qui la nomment, sinon l'arbitrage du superviseur), puis entre dans la section « Consommateurs » de l'interface du fournisseur."
|
|
330
335
|
);
|
|
331
336
|
}
|
|
332
337
|
if (refus.some(r => r.regle === DECLARE_NON_UTILISE)) {
|
|
333
|
-
|
|
334
|
-
"Un nom que son consommateur n'utilise plus sort de sa ligne dans la section « Consommateurs » de l'interface du fournisseur
|
|
338
|
+
sorties.push(
|
|
339
|
+
"Un nom que son consommateur n'utilise plus sort de sa ligne dans la section « Consommateurs » de l'interface du fournisseur."
|
|
335
340
|
);
|
|
336
341
|
}
|
|
337
|
-
|
|
338
|
-
|
|
342
|
+
return { lignes: sorties, code: refus.length ? 1 : 0 };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
346
|
+
const { lignes, code } = rapport(process.cwd());
|
|
347
|
+
for (const l of lignes) {
|
|
348
|
+
process.stderr.write(`${l}\n`);
|
|
339
349
|
}
|
|
350
|
+
process.exitCode = code;
|
|
340
351
|
}
|
|
@@ -178,6 +178,7 @@ export default {
|
|
|
178
178
|
'interfaces-contre-code',
|
|
179
179
|
'resumes',
|
|
180
180
|
'tailles-des-tests',
|
|
181
|
+
'tests-du-poste',
|
|
181
182
|
'titres-de-tests',
|
|
182
183
|
'turbo-des-paquets',
|
|
183
184
|
],
|
|
@@ -261,6 +262,7 @@ export default {
|
|
|
261
262
|
'interfaces-contre-code',
|
|
262
263
|
'code-mort',
|
|
263
264
|
'tailles-des-tests',
|
|
265
|
+
'tests-du-poste',
|
|
264
266
|
'titres-de-tests',
|
|
265
267
|
'chemins-des-tests',
|
|
266
268
|
'resumes',
|
|
@@ -51,7 +51,11 @@ import { elementsDuLot } from './elements-du-lot.mjs';
|
|
|
51
51
|
import { A_ELAGUER, lireSarif, RESULTATS } from '../../resultats.mjs';
|
|
52
52
|
import { lecteurs } from './lecteurs.mjs';
|
|
53
53
|
import { estUnTest, manifestes, soeurDAvant } from './regle-des-tests.mjs';
|
|
54
|
-
import {
|
|
54
|
+
import {
|
|
55
|
+
avecLeFichierDuPoste,
|
|
56
|
+
empreintesDesTaches,
|
|
57
|
+
SCRIPT_DES_TESTS,
|
|
58
|
+
} from '../../services-du-noyau.mjs';
|
|
55
59
|
import { verdict } from './verdict.mjs';
|
|
56
60
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
57
61
|
import { squelette } from './squelette.mjs';
|
|
@@ -65,6 +69,8 @@ import * as cheminsDesTests from './migrations/0.25.0-chemins-des-tests.mjs';
|
|
|
65
69
|
import * as taillesDesOutilsLourds from './migrations/0.30.0-tailles-des-outils-lourds.mjs';
|
|
66
70
|
import * as prefixeDesTickets from './migrations/0.30.0-prefixe-des-tickets.mjs';
|
|
67
71
|
import * as titresNommantUnTicket from './migrations/0.30.0-titres-nommant-un-ticket.mjs';
|
|
72
|
+
import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
|
|
73
|
+
import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
|
|
68
74
|
|
|
69
75
|
// The scripts of this module, beside this file.
|
|
70
76
|
const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -85,6 +91,7 @@ const OUTILS = [
|
|
|
85
91
|
'interfaces-contre-code',
|
|
86
92
|
'resumes',
|
|
87
93
|
'tailles-des-tests',
|
|
94
|
+
'tests-du-poste',
|
|
88
95
|
'titres-de-tests',
|
|
89
96
|
'turbo-des-paquets',
|
|
90
97
|
];
|
|
@@ -197,8 +204,9 @@ export default {
|
|
|
197
204
|
binaires: {},
|
|
198
205
|
// No program the installer of Temporal looks for: Node is a tool of the account.
|
|
199
206
|
executables: [],
|
|
200
|
-
// What its tools write in a project: Turborepo's runs and cache
|
|
201
|
-
|
|
207
|
+
// What its tools write in a project: Turborepo's runs and cache, and Vitest's reports of the
|
|
208
|
+
// tranches of a pass (./tranches.mjs).
|
|
209
|
+
ignorer: ['.turbo', '.vitest-reports'],
|
|
202
210
|
// Where its tools write: the cache of Turborepo in the main tree, shared by every copy, written;
|
|
203
211
|
// the logs of Turborepo's tasks (`.turbo/turbo-<task>.log`, written on every run, a task replayed
|
|
204
212
|
// from its cache included, and which no option of Turborepo sends elsewhere) and the cache of
|
|
@@ -235,6 +243,13 @@ export default {
|
|
|
235
243
|
elementsDuLot,
|
|
236
244
|
// The hashes of the inputs of the tests tasks of the packages and their dependents, as
|
|
237
245
|
// Turborepo plans them.
|
|
246
|
+
// The remote cache of Turborepo on the poste: its server, its team, its token and the key of its
|
|
247
|
+
// signature in ~/.config/grillhouse/turbo-cache.env, read alone, never written from the poste.
|
|
248
|
+
environnementDuPoste: env =>
|
|
249
|
+
avecLeFichierDuPoste(env, {
|
|
250
|
+
fichier: 'turbo-cache.env',
|
|
251
|
+
ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
|
|
252
|
+
}),
|
|
238
253
|
empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
|
|
239
254
|
commandes: racine => ({
|
|
240
255
|
tester: { script: ici('tests.mjs'), args: [] },
|
|
@@ -242,6 +257,7 @@ export default {
|
|
|
242
257
|
typer: { script: compilateur(racine), args: ['--noEmit'] },
|
|
243
258
|
construire: { script: ici('construire.mjs'), args: [] },
|
|
244
259
|
'tests-de-nuit': { script: ici('tests-de-nuit.mjs'), args: [] },
|
|
260
|
+
'fusion-des-tranches': { script: ici('tranches.mjs'), args: [] },
|
|
245
261
|
...Object.fromEntries(OUTILS.map(n => [n, { script: ici(`${n}.mjs`), args: [] }])),
|
|
246
262
|
}),
|
|
247
263
|
verdict,
|
|
@@ -310,6 +326,7 @@ export default {
|
|
|
310
326
|
[ici('interfaces-contre-code.mjs')],
|
|
311
327
|
[ici('code-mort.mjs')],
|
|
312
328
|
[ici('tailles-des-tests.mjs')],
|
|
329
|
+
[ici('tests-du-poste.mjs')],
|
|
313
330
|
[ici('titres-de-tests.mjs')],
|
|
314
331
|
[ici('chemins-des-tests.mjs')],
|
|
315
332
|
[ici('resumes.mjs')],
|
|
@@ -324,6 +341,8 @@ export default {
|
|
|
324
341
|
taillesDesOutilsLourds,
|
|
325
342
|
prefixeDesTickets,
|
|
326
343
|
titresNommantUnTicket,
|
|
344
|
+
binaireDeJour,
|
|
345
|
+
testsDuPoste,
|
|
327
346
|
],
|
|
328
347
|
miseAJour: miseAJour(joueDesTests),
|
|
329
348
|
squelette,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// From 0.33.0 the guard of the sizes of the tests (scripts/langages/typescript/tailles-des-tests.mjs)
|
|
2
|
+
// also refuses a test of the day that starts the frame's command (its binary, or a script of its
|
|
3
|
+
// `bin/` or `scripts/`) out of the zone of the end-to-end tests (a directory `e2e/`): a test of
|
|
4
|
+
// the day validates the code by importing it. A project whose tests start it would turn red at its
|
|
5
|
+
// next pass; as the migration 0.30.0 does for the heavy tools, the update inscribes them as the
|
|
6
|
+
// project's known debt (scripts/dette.mjs), frozen: the count never rises and a new one is refused.
|
|
7
|
+
//
|
|
8
|
+
// - The migration inscribes the findings of the guard that the debt does not hold yet; the debt
|
|
9
|
+
// already inscribed (the guard's, the other guards') stays.
|
|
10
|
+
// - It rewrites no test of the project: the project makes each one import what it proves, or moves
|
|
11
|
+
// it under a directory `e2e/`, and the debt comes down with it.
|
|
12
|
+
// - Replayable without effect: once every finding is inscribed, nothing.
|
|
13
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
14
|
+
import { BINAIRE_DE_JOUR, GARDE, verifier } from '../tailles-des-tests.mjs';
|
|
15
|
+
|
|
16
|
+
export const version = '0.33.0';
|
|
17
|
+
export const nom = 'binaire de jour';
|
|
18
|
+
|
|
19
|
+
/** Inscribes the tests of the day that start the frame's command the debt of <projet> lacks. */
|
|
20
|
+
export function migrer(projet) {
|
|
21
|
+
const inscrite = lire(projet)[GARDE] ?? {};
|
|
22
|
+
const constats = verifier(projet);
|
|
23
|
+
const neufs = constats.filter(
|
|
24
|
+
c => c.regle === BINAIRE_DE_JOUR && !inscrite[c.fichier]?.[c.regle]
|
|
25
|
+
);
|
|
26
|
+
if (neufs.length === 0) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
// Inscribed counts stay; a finding without key is added at its count.
|
|
30
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
31
|
+
return [
|
|
32
|
+
`${FICHIER} : ${neufs.length} test(s) de jour qui lance(nt) la commande grillhouse inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chacun importe ce qu'il prouve ou passe sous un dossier e2e/`,
|
|
33
|
+
];
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// From 0.33.0 the guard of the night tests of the poste (scripts/langages/typescript/tests-du-poste.mjs)
|
|
2
|
+
// refuses a night test that depends on the poste (the envelope, the real bd, a Temporal server,
|
|
3
|
+
// sccache, systemd, the keyring, the user's session, a session of claude) without the tag `@poste`
|
|
4
|
+
// at its head. A project whose night tests depend on it would turn red at its next pass; as the
|
|
5
|
+
// migration of the tests that start the frame's command does, the update inscribes them as the
|
|
6
|
+
// project's known debt (scripts/dette.mjs), frozen: the count never rises and a new one is refused.
|
|
7
|
+
//
|
|
8
|
+
// - The migration inscribes the findings of the guard that the debt does not hold yet; the debt
|
|
9
|
+
// already inscribed (the guard's, the other guards') stays.
|
|
10
|
+
// - It rewrites no test of the project: the project tags each one (`// @poste: <raison>` at its
|
|
11
|
+
// head), and the debt comes down with it.
|
|
12
|
+
// - Replayable without effect: once every finding is inscribed, nothing.
|
|
13
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
14
|
+
import { GARDE, verifier } from '../tests-du-poste.mjs';
|
|
15
|
+
|
|
16
|
+
export const version = '0.33.0';
|
|
17
|
+
export const nom = 'tests du poste';
|
|
18
|
+
|
|
19
|
+
/** Inscribes the night tests of the poste without the tag that the debt of <projet> lacks. */
|
|
20
|
+
export function migrer(projet) {
|
|
21
|
+
const inscrite = lire(projet)[GARDE] ?? {};
|
|
22
|
+
const constats = verifier(projet);
|
|
23
|
+
const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
|
|
24
|
+
if (neufs.length === 0) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
28
|
+
return [
|
|
29
|
+
`${FICHIER} : ${neufs.length} test(s) de nuit qui dépend(ent) du poste sans l'étiquette @poste inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chacun porte « // @poste: <raison> » en tête`,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { existsSync, readFileSync } from 'node:fs';
|
|
20
20
|
import path from 'node:path';
|
|
21
21
|
import { pathToFileURL } from 'node:url';
|
|
22
|
-
import { trancher } from '../../dette.mjs';
|
|
22
|
+
import { MODE, trancher } from '../../dette.mjs';
|
|
23
23
|
import { lire } from './index-interfaces.mjs';
|
|
24
24
|
import { aVerifier } from './interfaces-contre-code.mjs';
|
|
25
25
|
|
|
@@ -50,14 +50,24 @@ export function verifier(racine, env = process.env) {
|
|
|
50
50
|
return constats;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
|
|
54
|
+
// prefixed with `⛔`, then the debt's lines), and `code`, its exit code (1 on a refusal). The
|
|
55
|
+
// functional core of the command: it reads the repository and the project's debt and writes nothing
|
|
56
|
+
// to the standard streams; the command below is its shell. The refusals reach SARIF through
|
|
57
|
+
// `trancher` under the results directory <env> names (scripts/resultats.mjs); without it none is
|
|
58
|
+
// written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
59
|
+
export function rapport(racine, env = process.env) {
|
|
60
|
+
const { refus, lignes } = trancher(racine, 'resumes', verifier(racine, env), env[MODE] || undefined, env);
|
|
61
|
+
return {
|
|
62
|
+
lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes],
|
|
63
|
+
code: refus.length ? 1 : 0,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
54
|
-
const
|
|
55
|
-
const { refus, lignes } = trancher(racine, 'resumes', verifier(racine));
|
|
56
|
-
for (const r of refus) {
|
|
57
|
-
process.stderr.write(`⛔ ${r.message}\n`);
|
|
58
|
-
}
|
|
68
|
+
const { lignes, code } = rapport(process.cwd());
|
|
59
69
|
for (const l of lignes) {
|
|
60
70
|
process.stderr.write(`${l}\n`);
|
|
61
71
|
}
|
|
62
|
-
process.exitCode =
|
|
72
|
+
process.exitCode = code;
|
|
63
73
|
}
|