@roomi-fields/grillhouse 0.30.0 → 0.31.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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +30 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/dist/temporal/circuit/client.d.ts +2 -2
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +4 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +3 -3
- package/dist/temporal/circuit/contrat.js +8 -2
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +3 -3
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +5 -6
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +0 -4
- package/dist/temporal/installation.js +12 -34
- package/dist/temporal/installation.js.map +1 -1
- package/docs/ARCHITECTURE.md +49 -19
- package/docs/CADRE.md +10 -0
- package/docs/INTERFACE.md +8 -3
- package/package.json +2 -2
- package/scripts/activites.mjs +150 -77
- package/scripts/aiguillage.mjs +33 -11
- package/scripts/avancement.mjs +27 -10
- package/scripts/bilan.mjs +101 -25
- package/scripts/cadre.mjs +5 -2
- package/scripts/circuit.mjs +153 -57
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +54 -19
- package/scripts/dependances-internes.mjs +9 -3
- package/scripts/dernier-vert.mjs +54 -19
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +24 -8
- package/scripts/droits.mjs +40 -15
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +141 -48
- package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
- package/scripts/faits-du-circuit.mjs +1 -1
- package/scripts/flux-des-paquets.mjs +21 -7
- package/scripts/gardes-du-cadre.mjs +9 -3
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +84 -29
- package/scripts/integration/integrer.mjs +70 -24
- package/scripts/integration/rejeu.mjs +26 -9
- package/scripts/jointure.d.ts +6 -1
- package/scripts/langages/cargo/commandes.mjs +97 -18
- package/scripts/langages/cargo/composants.mjs +24 -8
- package/scripts/langages/cargo/index.mjs +4 -0
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +3 -1
- package/scripts/langages/python/index.mjs +4 -0
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +10 -3
- package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
- package/scripts/langages/typescript/tests.mjs +24 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
- package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
- package/scripts/langages/typescript/verdict.mjs +3 -1
- package/scripts/langages/typescript/verifier.mjs +28 -10
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +9 -3
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
- package/scripts/nuit.sh +15 -0
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.mjs +18 -7
- package/scripts/paquet-npm.mjs +15 -5
- package/scripts/paquets.mjs +12 -4
- package/scripts/passe-de-la-machine.mjs +7 -2
- package/scripts/places-de-la-machine.mjs +66 -12
- package/scripts/preparation.mjs +15 -5
- package/scripts/registre.mjs +6 -2
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +105 -37
- package/scripts/seances.mjs +22 -4
- package/scripts/services-du-noyau.mjs +1 -0
- package/scripts/sous-commandes.mjs +3 -1
- package/scripts/style-a-l-ecriture.mjs +48 -17
- package/scripts/tableau.mjs +34 -9
- package/scripts/taches-du-graphe.mjs +33 -13
- package/scripts/ticket-du-circuit.mjs +10 -0
- package/scripts/transitions.mjs +141 -24
- package/scripts/verrou-de-fichier.mjs +6 -2
- package/scripts/verrou-de-machine.mjs +123 -39
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +7 -1
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- package/skills/relecteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +12 -6
|
@@ -60,7 +60,6 @@ import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
|
60
60
|
import { createRequire } from 'node:module';
|
|
61
61
|
import path from 'node:path';
|
|
62
62
|
import { fileURLToPath } from 'node:url';
|
|
63
|
-
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
64
63
|
import { testsQuiLancent } from './lances.mjs';
|
|
65
64
|
|
|
66
65
|
// This directory, the frame's base configuration.
|
|
@@ -93,7 +92,9 @@ const sous = (f, dir) => {
|
|
|
93
92
|
export function lireChangements(chemin) {
|
|
94
93
|
const c = lireJson(chemin);
|
|
95
94
|
const liste = l => Array.isArray(l) && l.every(x => typeof x === 'string');
|
|
96
|
-
if (!c || typeof c.racine !== 'string' || !liste(c.fichiers) || !liste(c.supprimes))
|
|
95
|
+
if (!c || typeof c.racine !== 'string' || !liste(c.fichiers) || !liste(c.supprimes)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
97
98
|
return c;
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -104,7 +105,9 @@ const DU_HAUT = '$TURBO_ROOT$/';
|
|
|
104
105
|
// present): the patterns, an empty list when it names none or does not read.
|
|
105
106
|
function entreesDuBuild(dir, noms) {
|
|
106
107
|
const f = noms.map(n => path.join(dir, n)).find(n => existsSync(n));
|
|
107
|
-
if (!f)
|
|
108
|
+
if (!f) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
108
111
|
try {
|
|
109
112
|
const { parse } = createRequire(import.meta.url)('jsonc-parser');
|
|
110
113
|
const inputs = parse(readFileSync(f, 'utf8'), [], { allowTrailingComma: true })?.tasks?.build
|
|
@@ -119,7 +122,9 @@ function entreesDuBuild(dir, noms) {
|
|
|
119
122
|
// absolute path <a>, which lies in it (6 above).
|
|
120
123
|
function construit(racine, d, a) {
|
|
121
124
|
const r = path.relative(d, a);
|
|
122
|
-
if (TEST.test(r))
|
|
125
|
+
if (TEST.test(r)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
123
128
|
const motifs = entreesDuBuild(d, ['turbo.json']).flatMap(m =>
|
|
124
129
|
m === '$TURBO_EXTENDS$' ? entreesDuBuild(racine, ['turbo.json', 'turbo.jsonc']) : [m]
|
|
125
130
|
);
|
|
@@ -131,9 +136,13 @@ function construit(racine, d, a) {
|
|
|
131
136
|
(m.startsWith(DU_HAUT)
|
|
132
137
|
? couvre(path.relative(racine, a), m.slice(DU_HAUT.length))
|
|
133
138
|
: couvre(r, m));
|
|
134
|
-
if (motifs.some(m => m.startsWith('!') && lu(m.slice(1))))
|
|
139
|
+
if (motifs.some(m => m.startsWith('!') && lu(m.slice(1)))) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
135
142
|
const positifs = motifs.filter(m => !m.startsWith('!'));
|
|
136
|
-
if (positifs.length)
|
|
143
|
+
if (positifs.length) {
|
|
144
|
+
return positifs.some(lu);
|
|
145
|
+
}
|
|
137
146
|
return MODULE.test(r) && r.split(path.sep)[0] !== 'docs';
|
|
138
147
|
}
|
|
139
148
|
|
|
@@ -149,7 +158,9 @@ function dependances(racine, dossier) {
|
|
|
149
158
|
for (let ici = d; sous(ici, racine); ici = path.dirname(ici)) {
|
|
150
159
|
const lien = path.join(ici, 'node_modules', nom);
|
|
151
160
|
if (!existsSync(lien)) {
|
|
152
|
-
if (ici === racine)
|
|
161
|
+
if (ici === racine) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
153
164
|
continue;
|
|
154
165
|
}
|
|
155
166
|
let reel;
|
|
@@ -209,7 +220,9 @@ function paquetEntier(ch, dossier, test = {}) {
|
|
|
209
220
|
: sous(a, dossier) && !MODULE.test(f)
|
|
210
221
|
? 'un fichier qu’aucun module n’importe, qu’un test lit sans l’importer'
|
|
211
222
|
: null;
|
|
212
|
-
if (raison)
|
|
223
|
+
if (raison) {
|
|
224
|
+
return { raison, fichier: f };
|
|
225
|
+
}
|
|
213
226
|
}
|
|
214
227
|
return null;
|
|
215
228
|
}
|
|
@@ -19,7 +19,9 @@ export { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai };
|
|
|
19
19
|
|
|
20
20
|
const memoMatieres = new Map();
|
|
21
21
|
const matieresDe = racine => {
|
|
22
|
-
if (!memoMatieres.has(racine))
|
|
22
|
+
if (!memoMatieres.has(racine)) {
|
|
23
|
+
memoMatieres.set(racine, lesMatieres(racine));
|
|
24
|
+
}
|
|
23
25
|
return memoMatieres.get(racine);
|
|
24
26
|
};
|
|
25
27
|
|
|
@@ -43,8 +45,12 @@ export function reglagesDuFichier(fichier, options) {
|
|
|
43
45
|
/** The root of the repository that holds <fichier>: the first directory above with a `.git`. */
|
|
44
46
|
export function racineDuDepot(fichier) {
|
|
45
47
|
for (let d = path.dirname(fichier); ; d = path.dirname(d)) {
|
|
46
|
-
if (existsSync(path.join(d, '.git')))
|
|
47
|
-
|
|
48
|
+
if (existsSync(path.join(d, '.git'))) {
|
|
49
|
+
return d;
|
|
50
|
+
}
|
|
51
|
+
if (path.dirname(d) === d) {
|
|
52
|
+
return process.cwd();
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
|
|
@@ -21,16 +21,22 @@ const DELAI = /^(Test|Hook) timed out in \d+ms\./;
|
|
|
21
21
|
|
|
22
22
|
function* taches(t) {
|
|
23
23
|
yield t;
|
|
24
|
-
for (const c of t.tasks ?? [])
|
|
24
|
+
for (const c of t.tasks ?? []) {
|
|
25
|
+
yield* taches(c);
|
|
26
|
+
}
|
|
25
27
|
}
|
|
26
28
|
const fichierDe = t => {
|
|
27
29
|
let x = t;
|
|
28
|
-
while (x && !x.filepath)
|
|
30
|
+
while (x && !x.filepath) {
|
|
31
|
+
x = x.suite ?? x.file;
|
|
32
|
+
}
|
|
29
33
|
return x?.filepath ?? '';
|
|
30
34
|
};
|
|
31
35
|
const nomDe = t => {
|
|
32
36
|
const noms = [];
|
|
33
|
-
for (let x = t; x && !x.filepath; x = x.suite)
|
|
37
|
+
for (let x = t; x && !x.filepath; x = x.suite) {
|
|
38
|
+
noms.unshift(x.name);
|
|
39
|
+
}
|
|
34
40
|
return noms.join(' › ');
|
|
35
41
|
};
|
|
36
42
|
|
|
@@ -43,7 +49,9 @@ export function classer({ files = [], errors = [], debut, fin, codeDeSortie, fic
|
|
|
43
49
|
for (const f of files) {
|
|
44
50
|
for (const t of taches(f)) {
|
|
45
51
|
const erreurs = t.result?.errors ?? [];
|
|
46
|
-
if (t.type === 'test' ? t.result?.state !== 'fail' : erreurs.length === 0)
|
|
52
|
+
if (t.type === 'test' ? t.result?.state !== 'fail' : erreurs.length === 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
47
55
|
const fichier = fichierDe(t);
|
|
48
56
|
const info = fichiers[fichier];
|
|
49
57
|
const delaiDepasse = erreurs.length > 0 && erreurs.every(e => DELAI.test(e.message ?? ''));
|
|
@@ -31,8 +31,9 @@ import { classer } from './duree.classement.mjs';
|
|
|
31
31
|
import { delaisSurLeDisque, libelleDuDelai } from './delais.mjs';
|
|
32
32
|
|
|
33
33
|
function aUnEchec(t) {
|
|
34
|
-
if (t.type === 'test' ? t.result?.state === 'fail' : (t.result?.errors ?? []).length > 0)
|
|
34
|
+
if (t.type === 'test' ? t.result?.state === 'fail' : (t.result?.errors ?? []).length > 0) {
|
|
35
35
|
return true;
|
|
36
|
+
}
|
|
36
37
|
return (t.tasks ?? []).some(aUnEchec);
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -41,7 +42,9 @@ const PLUS_LENTS = 20;
|
|
|
41
42
|
function plusLents(files, dire) {
|
|
42
43
|
const duree = f => f.result?.duration ?? 0;
|
|
43
44
|
const total = files.reduce((s, f) => s + duree(f), 0);
|
|
44
|
-
if (total <= 0)
|
|
45
|
+
if (total <= 0) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
45
48
|
const lents = [...files].sort((a, b) => duree(b) - duree(a)).slice(0, PLUS_LENTS);
|
|
46
49
|
dire(
|
|
47
50
|
`${lents.length === 1 ? '1 fichier le plus lent' : `${lents.length} fichiers les plus lents`} (part du temps total, ${Math.round(total)} ms) :`
|
|
@@ -65,7 +68,9 @@ export default class DureeReporter {
|
|
|
65
68
|
plusLents(files, dire);
|
|
66
69
|
const fichiers = {};
|
|
67
70
|
for (const f of files) {
|
|
68
|
-
if (!aUnEchec(f) || f.filepath in fichiers)
|
|
71
|
+
if (!aUnEchec(f) || f.filepath in fichiers) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
69
74
|
fichiers[f.filepath] = {
|
|
70
75
|
horsDuJour: estHorsDuJour(f.filepath),
|
|
71
76
|
banc: estUnBanc(f.filepath),
|
|
@@ -84,14 +89,20 @@ export default class DureeReporter {
|
|
|
84
89
|
const nom = path.relative(process.cwd(), e.fichier) + (e.nom ? ` › ${e.nom}` : '');
|
|
85
90
|
const delai = e.delai ? ` (${e.delai})` : '';
|
|
86
91
|
if (e.cause === 'réel') {
|
|
87
|
-
if (e.delai)
|
|
92
|
+
if (e.delai) {
|
|
93
|
+
dire(`${nom} : délai dépassé${delai}.`);
|
|
94
|
+
}
|
|
88
95
|
continue;
|
|
89
96
|
}
|
|
90
97
|
dire(
|
|
91
98
|
`${nom} : ${e.cause}${delai}, pression CPU ${ecrirePression(e.pressionDebut)} au début, ${ecrirePression(e.pressionFin)} à la fin (seuil ${SEUIL_PRESSION} %).`
|
|
92
99
|
);
|
|
93
100
|
}
|
|
94
|
-
if (conclusion)
|
|
95
|
-
|
|
101
|
+
if (conclusion) {
|
|
102
|
+
dire(conclusion);
|
|
103
|
+
}
|
|
104
|
+
if (verdict === 'a-repasser') {
|
|
105
|
+
process.exitCode = A_REPASSER;
|
|
106
|
+
}
|
|
96
107
|
}
|
|
97
108
|
}
|
|
@@ -109,7 +109,9 @@ export function resoudreRelatif(de, spec, lireUn) {
|
|
|
109
109
|
const base = path.resolve(path.dirname(de), spec);
|
|
110
110
|
const sansJs = base.replace(/\.([cm]?)js$/, '.$1ts');
|
|
111
111
|
for (const c of [...SUFFIXES.map(s => base + s), sansJs]) {
|
|
112
|
-
if (lireUn(c) !== null)
|
|
112
|
+
if (lireUn(c) !== null) {
|
|
113
|
+
return c;
|
|
114
|
+
}
|
|
113
115
|
}
|
|
114
116
|
return null;
|
|
115
117
|
}
|
|
@@ -141,7 +143,9 @@ function sansCommentaires(texte) {
|
|
|
141
143
|
const c = texte[i];
|
|
142
144
|
const suivant = texte[i + 1];
|
|
143
145
|
if (c === '/' && suivant === '/') {
|
|
144
|
-
while (i < texte.length && texte[i] !== '\n')
|
|
146
|
+
while (i < texte.length && texte[i] !== '\n') {
|
|
147
|
+
i++;
|
|
148
|
+
}
|
|
145
149
|
} else if (c === '/' && suivant === '*') {
|
|
146
150
|
const fin = texte.indexOf('*/', i + 2);
|
|
147
151
|
i = fin < 0 ? texte.length : fin + 2;
|
|
@@ -181,7 +185,9 @@ function chainesDe(texte) {
|
|
|
181
185
|
j += texte[j] === '\\' ? 2 : 1;
|
|
182
186
|
}
|
|
183
187
|
const contenu = texte.slice(i + 1, j);
|
|
184
|
-
if (!(c === '`' && contenu.includes('${')))
|
|
188
|
+
if (!(c === '`' && contenu.includes('${'))) {
|
|
189
|
+
out.push(contenu);
|
|
190
|
+
}
|
|
185
191
|
i = j + 1;
|
|
186
192
|
}
|
|
187
193
|
return out;
|
|
@@ -200,7 +206,9 @@ function chaines(texte) {
|
|
|
200
206
|
// The value of <calcul>, kept in <memo> under <cle>: each reading of a directory, a resolution or a
|
|
201
207
|
// file's strings is made once per pass.
|
|
202
208
|
function memoise(memo, cle, calcul) {
|
|
203
|
-
if (!memo.has(cle))
|
|
209
|
+
if (!memo.has(cle)) {
|
|
210
|
+
memo.set(cle, calcul());
|
|
211
|
+
}
|
|
204
212
|
return memo.get(cle);
|
|
205
213
|
}
|
|
206
214
|
|
|
@@ -215,7 +223,9 @@ function resoudre(de, spec, racine) {
|
|
|
215
223
|
const f = resoudreRelatif(de, spec, lireLeDisque);
|
|
216
224
|
return f && reel(f);
|
|
217
225
|
}
|
|
218
|
-
if (spec.startsWith('node:') || path.isAbsolute(spec))
|
|
226
|
+
if (spec.startsWith('node:') || path.isAbsolute(spec)) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
219
229
|
try {
|
|
220
230
|
const f = reel(createRequire(de).resolve(spec));
|
|
221
231
|
return f && sous(f, racine) && horsModules(f) ? f : null;
|
|
@@ -227,7 +237,9 @@ function resoudre(de, spec, racine) {
|
|
|
227
237
|
// Whether the file <f> of the repository at <racine> is test material: under a directory of
|
|
228
238
|
// tests, or in a package of the shared material (`matieres` of ../composants.mjs).
|
|
229
239
|
function estMatiere(f, racine, memo) {
|
|
230
|
-
if (MATIERE.test(du(racine, f)))
|
|
240
|
+
if (MATIERE.test(du(racine, f))) {
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
231
243
|
return memoise(memo, 'matieres', () => matieres(racine)).some(m => sous(f, m.dir));
|
|
232
244
|
}
|
|
233
245
|
|
|
@@ -242,7 +254,9 @@ function commandes(racine, memo) {
|
|
|
242
254
|
? { [pkg.name.split('/').at(-1)]: pkg.bin }
|
|
243
255
|
: (pkg?.bin ?? {});
|
|
244
256
|
for (const [nom, f] of Object.entries(bin)) {
|
|
245
|
-
if (typeof f === 'string')
|
|
257
|
+
if (typeof f === 'string') {
|
|
258
|
+
out.set(nom, path.join(racine, dossier, f));
|
|
259
|
+
}
|
|
246
260
|
}
|
|
247
261
|
}
|
|
248
262
|
return out;
|
|
@@ -255,8 +269,12 @@ function commandes(racine, memo) {
|
|
|
255
269
|
function commandeLancee(chaine, racine, memo, ligne) {
|
|
256
270
|
const liste = commandes(racine, memo);
|
|
257
271
|
const parLien = /(?:^|\/)\.bin\/([\w@.-]+)$/.exec(chaine);
|
|
258
|
-
if (parLien)
|
|
259
|
-
|
|
272
|
+
if (parLien) {
|
|
273
|
+
return liste.get(parLien[1]) ?? null;
|
|
274
|
+
}
|
|
275
|
+
if (!ligne) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
260
278
|
for (const [nom, f] of liste) {
|
|
261
279
|
if (new RegExp(`(?:^|[\\s/"'])${nom.replace(/[.-]/g, '\\$&')}["']?\\s+[a-z]`).test(chaine)) {
|
|
262
280
|
return f;
|
|
@@ -270,9 +288,13 @@ function commandeLancee(chaine, racine, memo, ligne) {
|
|
|
270
288
|
// for a pattern that starts with a wildcard.
|
|
271
289
|
function couverts(motif, bases, racine) {
|
|
272
290
|
const fixe = motif.split('/').filter((s, i, l) => !l.slice(0, i + 1).some(x => MOTIF.test(x)));
|
|
273
|
-
if (fixe.length === 0)
|
|
291
|
+
if (fixe.length === 0) {
|
|
292
|
+
return [];
|
|
293
|
+
}
|
|
274
294
|
for (const b of bases) {
|
|
275
|
-
if (!existsSync(path.resolve(b, ...fixe)))
|
|
295
|
+
if (!existsSync(path.resolve(b, ...fixe))) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
276
298
|
return globSync(motif, { cwd: b, exclude: d => SAUTES.has(path.basename(d)) })
|
|
277
299
|
.map(f => path.resolve(b, f))
|
|
278
300
|
.filter(f => sous(f, racine) && horsModules(f) && !estDossier(f));
|
|
@@ -284,7 +306,9 @@ function couverts(motif, bases, racine) {
|
|
|
284
306
|
// first that exists): itself, or each file under it; none for a directory that holds the file
|
|
285
307
|
// <de> that writes it, or that is a package.
|
|
286
308
|
function nommes(chaine, bases, racine, de, memo, ligne = false) {
|
|
287
|
-
if (!/[\w.]/.test(chaine) || /^[a-z]+:/i.test(chaine))
|
|
309
|
+
if (!/[\w.]/.test(chaine) || /^[a-z]+:/i.test(chaine)) {
|
|
310
|
+
return [];
|
|
311
|
+
}
|
|
288
312
|
return memoise(memo, `nommes:${ligne}\0${bases.join('\0')}\0${path.dirname(de)}\0${chaine}`, () =>
|
|
289
313
|
resoudreNommes(chaine, bases, racine, de, memo, ligne)
|
|
290
314
|
);
|
|
@@ -292,16 +316,30 @@ function nommes(chaine, bases, racine, de, memo, ligne = false) {
|
|
|
292
316
|
|
|
293
317
|
function resoudreNommes(chaine, bases, racine, de, memo, ligne) {
|
|
294
318
|
const commande = commandeLancee(chaine, racine, memo, ligne);
|
|
295
|
-
if (commande)
|
|
296
|
-
|
|
297
|
-
|
|
319
|
+
if (commande) {
|
|
320
|
+
return [commande];
|
|
321
|
+
}
|
|
322
|
+
if (/[\s<>|^$]/.test(chaine)) {
|
|
323
|
+
return [];
|
|
324
|
+
}
|
|
325
|
+
if (MOTIF.test(chaine)) {
|
|
326
|
+
return couverts(chaine, bases, racine);
|
|
327
|
+
}
|
|
298
328
|
for (const b of bases) {
|
|
299
329
|
const c = path.resolve(b, chaine);
|
|
300
|
-
if (!existsSync(c))
|
|
330
|
+
if (!existsSync(c)) {
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
301
333
|
const r = reel(c);
|
|
302
|
-
if (!r || !sous(r, racine) || !horsModules(r))
|
|
303
|
-
|
|
304
|
-
|
|
334
|
+
if (!r || !sous(r, racine) || !horsModules(r)) {
|
|
335
|
+
return [];
|
|
336
|
+
}
|
|
337
|
+
if (!estDossier(r)) {
|
|
338
|
+
return [r];
|
|
339
|
+
}
|
|
340
|
+
if (sous(de, r) || existsSync(path.join(r, 'package.json'))) {
|
|
341
|
+
return [];
|
|
342
|
+
}
|
|
305
343
|
return memoise(memo, `dossier:${r}`, () => fichiersSous(r));
|
|
306
344
|
}
|
|
307
345
|
return [];
|
|
@@ -311,11 +349,15 @@ function resoudreNommes(chaine, bases, racine, de, memo, ligne) {
|
|
|
311
349
|
function materiel(fichier, racine, memo) {
|
|
312
350
|
const vus = [];
|
|
313
351
|
const suivre = f => {
|
|
314
|
-
if (vus.includes(f))
|
|
352
|
+
if (vus.includes(f)) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
315
355
|
vus.push(f);
|
|
316
356
|
for (const spec of specifiersDe(f, memo)) {
|
|
317
357
|
const cible = resoudreImport(f, spec, racine, memo);
|
|
318
|
-
if (cible && !TEST.test(cible) && estMatiere(cible, racine, memo))
|
|
358
|
+
if (cible && !TEST.test(cible) && estMatiere(cible, racine, memo)) {
|
|
359
|
+
suivre(cible);
|
|
360
|
+
}
|
|
319
361
|
}
|
|
320
362
|
};
|
|
321
363
|
suivre(fichier);
|
|
@@ -333,7 +375,9 @@ function nommesPar(fichier, dossier, racine, memo) {
|
|
|
333
375
|
for (const f of materiel(fichier, racine, memo)) {
|
|
334
376
|
const bases = [path.dirname(f), dossier, racine];
|
|
335
377
|
for (const c of chainesDuFichier(f, memo)) {
|
|
336
|
-
for (const n of nommes(c, bases, racine, f, memo, true))
|
|
378
|
+
for (const n of nommes(c, bases, racine, f, memo, true)) {
|
|
379
|
+
out.add(n);
|
|
380
|
+
}
|
|
337
381
|
}
|
|
338
382
|
}
|
|
339
383
|
return out;
|
|
@@ -347,7 +391,9 @@ function fermeture(depart, racine, memo) {
|
|
|
347
391
|
const pile = [...depart];
|
|
348
392
|
while (pile.length) {
|
|
349
393
|
const f = pile.pop();
|
|
350
|
-
if (vus.has(f))
|
|
394
|
+
if (vus.has(f)) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
351
397
|
vus.add(f);
|
|
352
398
|
if (SHELL.test(f)) {
|
|
353
399
|
// A script of the shell names the scripts it runs from its own directory, through a
|
|
@@ -361,7 +407,9 @@ function fermeture(depart, racine, memo) {
|
|
|
361
407
|
);
|
|
362
408
|
continue;
|
|
363
409
|
}
|
|
364
|
-
if (!MODULE.test(f))
|
|
410
|
+
if (!MODULE.test(f)) {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
365
413
|
const suite = memoise(memo, `suite:${f}`, () => [
|
|
366
414
|
...specifiersDe(f, memo)
|
|
367
415
|
.map(s => resoudreImport(f, s, racine, memo))
|
|
@@ -395,10 +443,16 @@ export function testsDuPaquet(dossier) {
|
|
|
395
443
|
*/
|
|
396
444
|
export function testsQuiLancent(dossier, racine, changes) {
|
|
397
445
|
const cibles = new Set(changes.map(f => reel(f) ?? f));
|
|
398
|
-
if (cibles.size === 0)
|
|
446
|
+
if (cibles.size === 0) {
|
|
447
|
+
return [];
|
|
448
|
+
}
|
|
399
449
|
const memo = new Map();
|
|
400
450
|
return testsDuPaquet(dossier).filter(t => {
|
|
401
|
-
for (const f of lusPar(t, dossier, racine, memo))
|
|
451
|
+
for (const f of lusPar(t, dossier, racine, memo)) {
|
|
452
|
+
if (cibles.has(f)) {
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
402
456
|
return false;
|
|
403
457
|
});
|
|
404
458
|
}
|
|
@@ -420,7 +474,9 @@ export function nonDeclares(dossier, racine, lit = [], memo = new Map()) {
|
|
|
420
474
|
const modules = [];
|
|
421
475
|
for (const f of fichiersSous(dossier)) {
|
|
422
476
|
const r = du(racine, f);
|
|
423
|
-
if (!MODULE.test(f) || TEST.test(f) || MATIERE.test(r) || dansLit(r, lit))
|
|
477
|
+
if (!MODULE.test(f) || TEST.test(f) || MATIERE.test(r) || dansLit(r, lit)) {
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
424
480
|
modules.push(f);
|
|
425
481
|
const parts = r.split('/');
|
|
426
482
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -18,5 +18,12 @@ process.env.GRILLHOUSE_VERROU_MACHINE ||= path.join(
|
|
|
18
18
|
tmpdir(),
|
|
19
19
|
`grillhouse-mesure-${process.pid}-${randomUUID()}.lock`
|
|
20
20
|
);
|
|
21
|
+
// The machine a test reads is a fixed one (GRILLHOUSE_MESURE_D_ESSAI, scripts/places-de-la-machine.mjs
|
|
22
|
+
// `etatDesPlaces`): no test reads the real load or memory of the user's machine.
|
|
23
|
+
process.env.GRILLHOUSE_MESURE_D_ESSAI ||= JSON.stringify({
|
|
24
|
+
coeurs: 12,
|
|
25
|
+
charge: 1,
|
|
26
|
+
memoireLibre: 16 * 1024 ** 3,
|
|
27
|
+
});
|
|
21
28
|
process.env.GRILLHOUSE_TEMPORAIRE_LIBRE ||= '0';
|
|
22
29
|
process.env.GRILLHOUSE_COPIE_LIBRE ||= '0';
|
|
@@ -17,7 +17,9 @@ export const VITEST = 'vitest';
|
|
|
17
17
|
// it; an empty list without the variable.
|
|
18
18
|
export function rapportJson(env = process.env, dossier = process.cwd()) {
|
|
19
19
|
const resultats = env[RESULTATS];
|
|
20
|
-
if (!resultats)
|
|
20
|
+
if (!resultats) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
21
23
|
const nom = `${dossier.split(path.sep).filter(Boolean).join('-') || 'racine'}-${process.pid}.json`;
|
|
22
24
|
return [['json', { outputFile: path.join(resultats, VITEST, nom) }]];
|
|
23
25
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// The guard `lint-des-scripts`, proper to the grillhouse package (it is in no project's list of
|
|
2
|
+
// guards): ESLint runs on `packages/grillhouse/scripts` of the working directory, and each error is
|
|
3
|
+
// counted per file and rule against the debt of `grillhouse-dette.json` (`trancher`, dette.mjs).
|
|
4
|
+
// An error beyond the inscribed count refuses with the file, the rule and the counts.
|
|
5
|
+
// ESLint is the repository's own tool, played by its executable (the package does not depend on it).
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
9
|
+
import { trancher } from './dette.mjs';
|
|
10
|
+
|
|
11
|
+
const DOSSIER = 'packages/grillhouse/scripts';
|
|
12
|
+
// The executable of ESLint in the repository's node_modules, from this file (packages/grillhouse/scripts).
|
|
13
|
+
const ESLINT = path.resolve(
|
|
14
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
15
|
+
'../../../node_modules/eslint/bin/eslint.js'
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// The ESLint errors of the scripts of <racine>, as `{ fichier, regle, ligne, message }`.
|
|
19
|
+
export async function verifier(racine) {
|
|
20
|
+
const r = spawnSync(process.execPath, [ESLINT, DOSSIER, '--ext', '.mjs', '-f', 'json'], {
|
|
21
|
+
cwd: racine,
|
|
22
|
+
encoding: 'utf8',
|
|
23
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
24
|
+
});
|
|
25
|
+
let resultats;
|
|
26
|
+
try {
|
|
27
|
+
resultats = JSON.parse(r.stdout);
|
|
28
|
+
} catch {
|
|
29
|
+
throw new Error(`ESLint n'a pas rendu de JSON : ${r.stderr || r.error?.message || r.stdout}`);
|
|
30
|
+
}
|
|
31
|
+
const constats = [];
|
|
32
|
+
for (const r of resultats) {
|
|
33
|
+
const fichier = path.relative(racine, r.filePath).split(path.sep).join('/');
|
|
34
|
+
for (const m of r.messages.filter(m => m.severity === 2)) {
|
|
35
|
+
constats.push({
|
|
36
|
+
fichier,
|
|
37
|
+
regle: m.ruleId ?? 'parse',
|
|
38
|
+
ligne: m.line,
|
|
39
|
+
message: `${fichier}:${m.line} ${m.ruleId ?? 'parse'} — ${m.message}`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return constats;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
47
|
+
// The root of the repository: the first argument (the script `lint` of the package passes it),
|
|
48
|
+
// the working directory otherwise.
|
|
49
|
+
const racine = path.resolve(process.argv[2] ?? process.cwd());
|
|
50
|
+
const { refus, lignes } = trancher(racine, 'lint-des-scripts', await verifier(racine));
|
|
51
|
+
for (const r of refus) {
|
|
52
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
53
|
+
}
|
|
54
|
+
for (const l of lignes) {
|
|
55
|
+
process.stderr.write(`${l}\n`);
|
|
56
|
+
}
|
|
57
|
+
process.exitCode = refus.length ? 1 : 0;
|
|
58
|
+
}
|