@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.
Files changed (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +30 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/dist/temporal/circuit/client.d.ts +2 -2
  8. package/dist/temporal/circuit/client.js.map +1 -1
  9. package/dist/temporal/circuit/commande.js +4 -4
  10. package/dist/temporal/circuit/commande.js.map +1 -1
  11. package/dist/temporal/circuit/contrat.d.ts +3 -3
  12. package/dist/temporal/circuit/contrat.js +8 -2
  13. package/dist/temporal/circuit/contrat.js.map +1 -1
  14. package/dist/temporal/circuit/deroule.js +3 -3
  15. package/dist/temporal/circuit/deroule.js.map +1 -1
  16. package/dist/temporal/commande.js +5 -6
  17. package/dist/temporal/commande.js.map +1 -1
  18. package/dist/temporal/installation.d.ts +0 -4
  19. package/dist/temporal/installation.js +12 -34
  20. package/dist/temporal/installation.js.map +1 -1
  21. package/docs/ARCHITECTURE.md +49 -19
  22. package/docs/CADRE.md +10 -0
  23. package/docs/INTERFACE.md +8 -3
  24. package/package.json +2 -2
  25. package/scripts/activites.mjs +150 -77
  26. package/scripts/aiguillage.mjs +33 -11
  27. package/scripts/avancement.mjs +27 -10
  28. package/scripts/bilan.mjs +101 -25
  29. package/scripts/cadre.mjs +5 -2
  30. package/scripts/circuit.mjs +153 -57
  31. package/scripts/composants-affectes.mjs +64 -21
  32. package/scripts/composition-des-langages.mjs +5 -3
  33. package/scripts/conformite.mjs +54 -19
  34. package/scripts/dependances-internes.mjs +9 -3
  35. package/scripts/dernier-vert.mjs +54 -19
  36. package/scripts/dette.mjs +32 -11
  37. package/scripts/donnees-cles.mjs +24 -8
  38. package/scripts/droits.mjs +40 -15
  39. package/scripts/empreinte-d-etape.mjs +17 -0
  40. package/scripts/engendres.mjs +15 -5
  41. package/scripts/enveloppe/enveloppe.mjs +141 -48
  42. package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
  43. package/scripts/faits-du-circuit.mjs +1 -1
  44. package/scripts/flux-des-paquets.mjs +21 -7
  45. package/scripts/gardes-du-cadre.mjs +9 -3
  46. package/scripts/init.mjs +11 -4
  47. package/scripts/integration/file.mjs +84 -29
  48. package/scripts/integration/integrer.mjs +70 -24
  49. package/scripts/integration/rejeu.mjs +26 -9
  50. package/scripts/jointure.d.ts +6 -1
  51. package/scripts/langages/cargo/commandes.mjs +97 -18
  52. package/scripts/langages/cargo/composants.mjs +24 -8
  53. package/scripts/langages/cargo/index.mjs +4 -0
  54. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  55. package/scripts/langages/python/commandes.mjs +3 -1
  56. package/scripts/langages/python/index.mjs +4 -0
  57. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  58. package/scripts/langages/typescript/composants.mjs +9 -3
  59. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  60. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  61. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  62. package/scripts/langages/typescript/frontieres.mjs +66 -22
  63. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  64. package/scripts/langages/typescript/index.mjs +10 -3
  65. package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
  66. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  67. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  68. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  69. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  70. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
  71. package/scripts/langages/typescript/parcours.mjs +12 -4
  72. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  73. package/scripts/langages/typescript/resumes.mjs +9 -3
  74. package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
  75. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
  76. package/scripts/langages/typescript/tests.mjs +24 -8
  77. package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
  78. package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
  79. package/scripts/langages/typescript/verdict.mjs +3 -1
  80. package/scripts/langages/typescript/verifier.mjs +28 -10
  81. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  82. package/scripts/langages/typescript/vitest-config/base.mjs +7 -2
  83. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  84. package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
  85. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
  86. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
  87. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  88. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
  89. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  90. package/scripts/lint-des-scripts.mjs +58 -0
  91. package/scripts/mesure/base-de-passe.mjs +117 -25
  92. package/scripts/mesure/pression.mjs +9 -3
  93. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  94. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  95. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  96. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
  97. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  98. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  99. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
  100. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
  101. package/scripts/nuit.sh +15 -0
  102. package/scripts/outil.mjs +3 -1
  103. package/scripts/outils-cles.mjs +18 -7
  104. package/scripts/paquet-npm.mjs +15 -5
  105. package/scripts/paquets.mjs +12 -4
  106. package/scripts/passe-de-la-machine.mjs +7 -2
  107. package/scripts/places-de-la-machine.mjs +66 -12
  108. package/scripts/preparation.mjs +15 -5
  109. package/scripts/registre.mjs +6 -2
  110. package/scripts/reprise.mjs +66 -0
  111. package/scripts/resultats.mjs +105 -37
  112. package/scripts/seances.mjs +22 -4
  113. package/scripts/services-du-noyau.mjs +1 -0
  114. package/scripts/sous-commandes.mjs +3 -1
  115. package/scripts/style-a-l-ecriture.mjs +48 -17
  116. package/scripts/tableau.mjs +34 -9
  117. package/scripts/taches-du-graphe.mjs +33 -13
  118. package/scripts/ticket-du-circuit.mjs +10 -0
  119. package/scripts/transitions.mjs +141 -24
  120. package/scripts/verrou-de-fichier.mjs +6 -2
  121. package/scripts/verrou-de-machine.mjs +123 -39
  122. package/scripts/verrous/commande.mjs +50 -17
  123. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  124. package/scripts/verrous/verrou.mjs +42 -14
  125. package/skills/explorateur/SKILL.md +7 -1
  126. package/skills/grill/SKILL.md +1 -1
  127. package/skills/mesure/SKILL.md +3 -0
  128. package/skills/relecteur/SKILL.md +1 -1
  129. package/skills/testwriter/SKILL.md +12 -6
@@ -119,6 +119,7 @@ import {
119
119
  existsSync,
120
120
  mkdirSync,
121
121
  openSync,
122
+ readdirSync,
122
123
  readFileSync,
123
124
  rmSync,
124
125
  writeFileSync,
@@ -285,7 +286,10 @@ function passe(racine, env) {
285
286
  ecrire();
286
287
  return { t, args };
287
288
  },
288
- jouer({ t, args }, { junit = null, journal = null, programme = 'cargo' } = {}) {
289
+ jouer(
290
+ { t, args },
291
+ { junit = null, journal = null, programme = 'cargo', temporaire = {} } = {}
292
+ ) {
289
293
  // A report of an earlier run is no report of this one, which may write none.
290
294
  if (junit) {
291
295
  rmSync(junit, { force: true });
@@ -305,7 +309,7 @@ function passe(racine, env) {
305
309
  try {
306
310
  r = spawnSync(programme, args, {
307
311
  cwd: racine,
308
- env: compilation,
312
+ env: { ...compilation, ...temporaire },
309
313
  stdio: ['inherit', fd, fd],
310
314
  });
311
315
  } finally {
@@ -314,7 +318,11 @@ function passe(racine, env) {
314
318
  process.stderr.write(readFileSync(journal, 'utf8'));
315
319
  t.journal = path.relative(racine, journal);
316
320
  } else {
317
- r = spawnSync(programme, args, { cwd: racine, env: compilation, stdio: 'inherit' });
321
+ r = spawnSync(programme, args, {
322
+ cwd: racine,
323
+ env: { ...compilation, ...temporaire },
324
+ stdio: 'inherit',
325
+ });
318
326
  }
319
327
  t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
320
328
  if (junit && dossier && existsSync(junit)) {
@@ -328,6 +336,15 @@ function passe(racine, env) {
328
336
  ecrire();
329
337
  return t.code;
330
338
  },
339
+ // Turns red the first green task of tests of <paquet>: what its tests left in its temporary
340
+ // directory fails it.
341
+ rougir(paquet) {
342
+ const t = taches.find(x => x.paquet === paquet && x.tests && x.code === 0);
343
+ if (t) {
344
+ t.code = 1;
345
+ ecrire();
346
+ }
347
+ },
331
348
  code() {
332
349
  const rouges = taches.filter(t => t.code !== 0);
333
350
  if (rouges.length === 0) {
@@ -363,7 +380,7 @@ function sousCharge(t, pressions) {
363
380
  // the build of its test targets first, then nextest, then its doctests; a failed build leaves the
364
381
  // crate's other tasks not played. The benches named, each crate's in a task `budget`, are
365
382
  // planned with the rest and played by the function this one returns, after the other tests.
366
- function jouerLesTests(racine, p, choix, options) {
383
+ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
367
384
  const m = metadonnees(racine);
368
385
  // Nextest's store is `target/nextest` under the workspace's root (its default `store.dir`),
369
386
  // whatever the target directory of the compilations (./sccache.mjs).
@@ -416,21 +433,34 @@ function jouerLesTests(racine, p, choix, options) {
416
433
  : []
417
434
  : nommes;
418
435
  const args = [...nextest, '-p', nom, ...selection, ...options];
419
- prevues.push([p.prevoir(nom, d, 'nextest', true, args), { junit }]);
436
+ prevues.push([
437
+ p.prevoir(nom, d, 'nextest', true, args),
438
+ { junit, temporaire: temporaire(nom) },
439
+ ]);
420
440
  }
421
441
  if (desBancs.length) {
422
442
  const args = [...nextestDuBanc, '-p', nom, ...desBancs.flatMap(n => ['--test', n])];
423
- bancs.push({ nom, d, args: [...args, '--test-threads', '1', ...options], etat });
443
+ bancs.push({
444
+ nom,
445
+ d,
446
+ temporaire: temporaire(nom),
447
+ args: [...args, '--test-threads', '1', ...options],
448
+ etat,
449
+ });
424
450
  }
425
451
  }
426
452
  const doctests = c.cibles.some(t => t.kind.includes('lib') && t.doctest !== false);
427
453
  if ((cibles.length === 0 || avecLeJour) && doctests) {
428
454
  const args = ['test', '--doc', ...j, '-p', nom];
429
- prevues.push([p.prevoir(nom, d, 'doctest', true, args), {}]);
455
+ prevues.push([p.prevoir(nom, d, 'doctest', true, args), { temporaire: temporaire(nom) }]);
430
456
  }
431
457
  parCrate.push([prevues, etat]);
432
458
  }
433
- const prevusBancs = bancs.map(b => [p.prevoir(b.nom, b.d, BUDGET, true, b.args), b.etat]);
459
+ const prevusBancs = bancs.map(b => [
460
+ p.prevoir(b.nom, b.d, BUDGET, true, b.args),
461
+ b.etat,
462
+ b.temporaire,
463
+ ]);
434
464
  for (const [prevues, etat] of parCrate) {
435
465
  for (const [t, o] of prevues) {
436
466
  if (p.jouer(t, o) !== 0 && t.t.script === 'build') {
@@ -440,9 +470,9 @@ function jouerLesTests(racine, p, choix, options) {
440
470
  }
441
471
  }
442
472
  return () => {
443
- for (const [t, etat] of prevusBancs) {
473
+ for (const [t, etat, temporaire] of prevusBancs) {
444
474
  if (etat.construit) {
445
- p.jouer(t, { junit });
475
+ p.jouer(t, { junit, temporaire });
446
476
  }
447
477
  }
448
478
  };
@@ -597,12 +627,38 @@ const CACHE_DE_NODE = 'node-compile-cache';
597
627
  // Plays <jouer>(env) under the base of a pass of <genre> in the temporary directory of <env>,
598
628
  // named to cargo in TMPDIR, TMP and TEMP: its code, 1 when the tests left something there, named.
599
629
  // The base goes at the end, or at an interruption.
630
+ //
631
+ // <jouer>(env, parPaquet) also receives `parPaquet`: `{ temporaire(nom), restes(nom) }`, the
632
+ // sub-directory of the base one package's tests play under (made at the first call, named in
633
+ // TMPDIR, TMP and TEMP) and what is left in it, so a leftover has the package that left it. The
634
+ // base's own line names what lies beside those sub-directories.
600
635
  function sousLaBase(genre, env, jouer) {
601
636
  const base = ouvrirBase(genre, { dans: env.TMPDIR || tmpdir() });
602
637
  const lacher = retirerALInterruption(base.fermer);
638
+ const dossiers = new Map();
639
+ const parPaquet = {
640
+ temporaire(nom) {
641
+ if (!dossiers.has(nom)) {
642
+ const d = path.join(base.dossier, nom);
643
+ mkdirSync(d, { recursive: true });
644
+ dossiers.set(nom, d);
645
+ }
646
+ const d = dossiers.get(nom);
647
+ return { TMPDIR: d, TMP: d, TEMP: d };
648
+ },
649
+ restes(nom) {
650
+ try {
651
+ return readdirSync(dossiers.get(nom)).sort();
652
+ } catch {
653
+ return [];
654
+ }
655
+ },
656
+ };
603
657
  try {
604
- const code = jouer({ ...env, ...base.env });
605
- const ligne = ligneDesRestes(base.restes().filter(n => n !== CACHE_DE_NODE));
658
+ const code = jouer({ ...env, ...base.env }, parPaquet);
659
+ const ligne = ligneDesRestes(
660
+ base.restes().filter(n => n !== CACHE_DE_NODE && !dossiers.has(n))
661
+ );
606
662
  if (!ligne) {
607
663
  return code;
608
664
  }
@@ -705,10 +761,12 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
705
761
  return surUnePlace(e => tester(racine, tous, args, e), { env });
706
762
  }
707
763
  if (nom === 'tests-du-paquet') {
708
- return sousLaBase('tests', env, envBase => testsDuPaquet(racine, tous, args, envBase));
764
+ return sousLaBase('tests', env, (envBase, pp) =>
765
+ testsDuPaquet(racine, tous, args, envBase, pp)
766
+ );
709
767
  }
710
768
  if (nom === 'tests-de-nuit') {
711
- return sousLaBase('tests', env, envBase => testsDeNuit(racine, tous, envBase));
769
+ return sousLaBase('tests', env, (envBase, pp) => testsDeNuit(racine, tous, envBase, pp));
712
770
  }
713
771
  process.stderr.write(`⛔ commande inconnue du module cargo : ${nom} (${NOMS.join(', ')})\n`);
714
772
  return 2;
@@ -758,7 +816,7 @@ function tester(racine, tous, args, env) {
758
816
  // The pass of `tests-du-paquet` in <racine>, the crates <tous>, its arguments <args>, under <env>:
759
817
  // the body of the task `test:unit` of a crate. The paths its script names, completed by those of
760
818
  // the variable of the task that lie in the same crate.
761
- function testsDuPaquet(racine, tous, args, env) {
819
+ function testsDuPaquet(racine, tous, args, env, parPaquet) {
762
820
  const donnes = args.filter(a => !a.startsWith('-'));
763
821
  if (donnes.length === 0) {
764
822
  process.stderr.write(
@@ -781,20 +839,41 @@ function testsDuPaquet(racine, tous, args, env) {
781
839
  return 2;
782
840
  }
783
841
  const p = passe(racine, env);
784
- jouerLesTests(racine, p, r.choix, [...args.filter(a => a.startsWith('-')), ...options])();
842
+ jouerLesTests(
843
+ racine,
844
+ p,
845
+ r.choix,
846
+ [...args.filter(a => a.startsWith('-')), ...options],
847
+ parPaquet.temporaire
848
+ )();
849
+ restesParPaquet(p, r.choix, parPaquet);
785
850
  return p.code();
786
851
  }
787
852
 
853
+ // The line of the guard of each crate of <choix> whose tests left something in its temporary
854
+ // directory, naming it, and its task of tests turned red in the run <p>.
855
+ function restesParPaquet(p, choix, parPaquet) {
856
+ for (const { c } of choix) {
857
+ const nom = c.composant.nom;
858
+ const ligne = ligneDesRestes(parPaquet.restes(nom), nom);
859
+ if (ligne) {
860
+ process.stderr.write(`${ligne}\n`);
861
+ p.rougir(nom);
862
+ }
863
+ }
864
+ }
865
+
788
866
  // The pass of `tests-de-nuit` in <racine>, the crates <tous>, under <env>: the night tests and the
789
867
  // benches of each crate that holds some, each named.
790
- function testsDeNuit(racine, tous, env) {
868
+ function testsDeNuit(racine, tous, env, parPaquet) {
791
869
  const p = passe(racine, env);
792
870
  const choix = tous
793
871
  .filter(c => joueDesTests(racine, c.composant))
794
872
  .map(c => ({ c, cibles: c.cibles.filter(horsDuJour).map(t => t.name) }))
795
873
  .filter(x => x.cibles.length);
796
874
  if (choix.length) {
797
- jouerLesTests(racine, p, choix, [])();
875
+ jouerLesTests(racine, p, choix, [], parPaquet.temporaire)();
876
+ restesParPaquet(p, choix, parPaquet);
798
877
  }
799
878
  return p.code();
800
879
  }
@@ -365,7 +365,9 @@ function partiesHors(a, b) {
365
365
  const cles = (x, y) => [...new Set([...Object.keys(x), ...Object.keys(y)])].sort();
366
366
  const out = [];
367
367
  for (const k of cles(a, b)) {
368
- if (k === DES_TESTS || isDeepStrictEqual(a[k], b[k])) continue;
368
+ if (k === DES_TESTS || isDeepStrictEqual(a[k], b[k])) {
369
+ continue;
370
+ }
369
371
  if (k !== 'target') {
370
372
  const tableau = [a[k], b[k]].some(v => v !== null && typeof v === 'object');
371
373
  out.push(tableau ? `[${k}]` : k);
@@ -375,7 +377,9 @@ function partiesHors(a, b) {
375
377
  for (const c of cles(ta, tb)) {
376
378
  const [ca, cb] = [table(ta[c]), table(tb[c])];
377
379
  for (const s of cles(ca, cb)) {
378
- if (s !== DES_TESTS && !isDeepStrictEqual(ca[s], cb[s])) out.push(`[target.${c}.${s}]`);
380
+ if (s !== DES_TESTS && !isDeepStrictEqual(ca[s], cb[s])) {
381
+ out.push(`[target.${c}.${s}]`);
382
+ }
379
383
  }
380
384
  }
381
385
  }
@@ -415,7 +419,9 @@ function finDuLexeme(texte, i) {
415
419
  j++;
416
420
  } else if (texte.startsWith('*/', j)) {
417
421
  j++;
418
- if (--profondeur === 0) return j + 1;
422
+ if (--profondeur === 0) {
423
+ return j + 1;
424
+ }
419
425
  }
420
426
  }
421
427
  return texte.length;
@@ -423,8 +429,12 @@ function finDuLexeme(texte, i) {
423
429
  for (const re of [BRUTE, CHAINE, CARACTERE]) {
424
430
  re.lastIndex = i;
425
431
  const m = re.exec(texte);
426
- if (!m) continue;
427
- if (re !== BRUTE) return m.index + m[0].length;
432
+ if (!m) {
433
+ continue;
434
+ }
435
+ if (re !== BRUTE) {
436
+ return m.index + m[0].length;
437
+ }
428
438
  const fin = texte.indexOf(`"${m[1]}`, i + m[0].length);
429
439
  return fin < 0 ? texte.length : fin + 1 + m[1].length;
430
440
  }
@@ -506,8 +516,12 @@ function horsDesTests(chemin, racine, avant, apres) {
506
516
  const parts = c ? path.relative(c.dossier, abs).split(path.sep) : [];
507
517
  return parts[0] === 'src' && !unitaire(parts) ? codeHorsDuModuleDeTest(avant, apres) : null;
508
518
  }
509
- if (path.basename(abs) !== 'Cargo.toml') return null;
510
- if (!tous.some(c => path.join(c.composant.dossier, 'Cargo.toml') === abs)) return null;
519
+ if (path.basename(abs) !== 'Cargo.toml') {
520
+ return null;
521
+ }
522
+ if (!tous.some(c => path.join(c.composant.dossier, 'Cargo.toml') === abs)) {
523
+ return null;
524
+ }
511
525
  const { parse } = require('smol-toml');
512
526
  const lire = texte => {
513
527
  try {
@@ -517,7 +531,9 @@ function horsDesTests(chemin, racine, avant, apres) {
517
531
  }
518
532
  };
519
533
  const [a, b] = [lire(avant), lire(apres)];
520
- if (a.faute || b.faute) return [a.faute ?? b.faute];
534
+ if (a.faute || b.faute) {
535
+ return [a.faute ?? b.faute];
536
+ }
521
537
  return partiesHors(a.valeur, b.valeur);
522
538
  }
523
539
 
@@ -38,6 +38,7 @@
38
38
  import { readFileSync } from 'node:fs';
39
39
  import path from 'node:path';
40
40
  import { fileURLToPath } from 'node:url';
41
+ import { empreintesDesTaches } from '../../services-du-noyau.mjs';
41
42
  import { commandes, fichierHorsDuJour, GARDES } from './commandes.mjs';
42
43
  import {
43
44
  composantDans,
@@ -120,6 +121,9 @@ export default {
120
121
  joueDesTests,
121
122
  lecteurs,
122
123
  elementsDuLot,
124
+ // The hashes of the inputs of the tests tasks of the crates and their dependents, as
125
+ // Turborepo plans them.
126
+ empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
123
127
  commandes,
124
128
  verdict,
125
129
  estUnTest,
@@ -55,7 +55,9 @@ export function sansLitteraux(t) {
55
55
  }
56
56
  if (t[i] === '"') {
57
57
  i++;
58
- while (i < t.length && t[i] !== '"') i += t[i] === '\\' ? 2 : 1;
58
+ while (i < t.length && t[i] !== '"') {
59
+ i += t[i] === '\\' ? 2 : 1;
60
+ }
59
61
  i++;
60
62
  out += ' ';
61
63
  continue;
@@ -93,19 +95,29 @@ export function lireLeFichier(texte) {
93
95
  let profondeur = 1;
94
96
  let k = jeton.lastIndex;
95
97
  while (k < t.length && profondeur > 0) {
96
- if (t[k] === '[') profondeur++;
97
- else if (t[k] === ']') profondeur--;
98
+ if (t[k] === '[') {
99
+ profondeur++;
100
+ } else if (t[k] === ']') {
101
+ profondeur--;
102
+ }
98
103
  k++;
99
104
  }
100
105
  const attribut = t.slice(jeton.lastIndex, k - 1).trim();
101
- if (/^(?:\w+\s*::\s*)*test$/.test(attribut)) marque = true;
106
+ if (/^(?:\w+\s*::\s*)*test$/.test(attribut)) {
107
+ marque = true;
108
+ }
102
109
  jeton.lastIndex = k;
103
110
  } else if (m[1]) {
104
- if (m[2] === '{') pile.push(m[1]);
105
- else externes.push([...ici(), m[1]]);
111
+ if (m[2] === '{') {
112
+ pile.push(m[1]);
113
+ } else {
114
+ externes.push([...ici(), m[1]]);
115
+ }
106
116
  marque = false;
107
117
  } else if (m[3]) {
108
- if (marque) tests.push([...ici(), m[3]]);
118
+ if (marque) {
119
+ tests.push([...ici(), m[3]]);
120
+ }
109
121
  marque = false;
110
122
  } else if (j === '{') {
111
123
  pile.push(null);
@@ -128,7 +140,9 @@ export function lireLeFichier(texte) {
128
140
  */
129
141
  export function nomsDeHead(chemin, module, lire) {
130
142
  const texte = lire(chemin);
131
- if (texte === null) return null;
143
+ if (texte === null) {
144
+ return null;
145
+ }
132
146
  if (module) {
133
147
  return lireLeFichier(texte).tests.map(t => [...module, ...t].join('::'));
134
148
  }
@@ -136,7 +150,9 @@ export function nomsDeHead(chemin, module, lire) {
136
150
  const vus = new Set();
137
151
  // The file <f> of text <tx>, its modules under <dossier>, its tests under <prefixe>.
138
152
  const parcourir = (f, tx, dossier, prefixe) => {
139
- if (vus.has(f)) return;
153
+ if (vus.has(f)) {
154
+ return;
155
+ }
140
156
  vus.add(f);
141
157
  const { tests, externes } = lireLeFichier(tx);
142
158
  noms.push(...tests.map(t => [...prefixe, ...t].join('::')));
@@ -263,7 +263,9 @@ function jouerLesTests(p, choix, options) {
263
263
  // The workers of a session of an agent (GRILLHOUSE_TRAVAILLEURS): `-n` of pytest-xdist, for a
264
264
  // package whose test group declares it; a heavy pass, without the variable, plays alone.
265
265
  const travailleurs = travailleursDeLaSeance(process.env);
266
- if (travailleurs !== null && declareXdist(c.dossier)) args.push('-n', String(travailleurs));
266
+ if (travailleurs !== null && declareXdist(c.dossier)) {
267
+ args.push('-n', String(travailleurs));
268
+ }
267
269
  const entier = chemins.every(ch => ch === '.');
268
270
  p.jouer(
269
271
  p.prevoir(c.nom, c.dossier, 'pytest', true, [...args, ...selection(chemins), ...options]),
@@ -33,6 +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
37
  import { commandes, GARDES, PYCACHE } from './commandes.mjs';
37
38
  import {
38
39
  composantDans,
@@ -88,6 +89,9 @@ export default {
88
89
  joueDesTests,
89
90
  lecteurs,
90
91
  elementsDuLot,
92
+ // The hashes of the inputs of the tests tasks of the projects and their dependents, as
93
+ // Turborepo plans them.
94
+ empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
91
95
  commandes,
92
96
  verdict,
93
97
  estUnTest,
@@ -62,7 +62,11 @@ export function verifier(racine) {
62
62
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
63
63
  const racine = process.cwd();
64
64
  const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
65
- for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
66
- for (const l of lignes) process.stderr.write(`${l}\n`);
65
+ for (const r of refus) {
66
+ process.stderr.write(`⛔ ${r.message}\n`);
67
+ }
68
+ for (const l of lignes) {
69
+ process.stderr.write(`${l}\n`);
70
+ }
67
71
  process.exitCode = refus.length ? 1 : 0;
68
72
  }
@@ -12,9 +12,13 @@ function tousDossiers(racine) {
12
12
  const found = [];
13
13
  for (const parent of ['packages', 'src']) {
14
14
  const base = path.join(racine, parent);
15
- if (!existsSync(base)) continue;
15
+ if (!existsSync(base)) {
16
+ continue;
17
+ }
16
18
  for (const e of readdirSync(base, { withFileTypes: true })) {
17
- if (e.isDirectory()) found.push({ nom: e.name, dir: path.join(base, e.name) });
19
+ if (e.isDirectory()) {
20
+ found.push({ nom: e.name, dir: path.join(base, e.name) });
21
+ }
18
22
  }
19
23
  }
20
24
  return found;
@@ -48,7 +52,9 @@ export function matieres(racine) {
48
52
  const found = [];
49
53
  for (const { nom, dir } of dossiers(racine)) {
50
54
  const pj = path.join(dir, 'package.json');
51
- if (!existsSync(pj)) continue;
55
+ if (!existsSync(pj)) {
56
+ continue;
57
+ }
52
58
  let paquet;
53
59
  try {
54
60
  paquet = JSON.parse(readFileSync(pj, 'utf8'));
@@ -55,8 +55,11 @@ function lignesConsommateurs(texte) {
55
55
  const out = [];
56
56
  let dedans = false;
57
57
  for (const l of ecrites) {
58
- if (/^##\s/.test(l)) dedans = /^##\s+Consommateurs\s*$/.test(l);
59
- else if (dedans && /^\s*-\s+\S/.test(l)) out.push(l.trim());
58
+ if (/^##\s/.test(l)) {
59
+ dedans = /^##\s+Consommateurs\s*$/.test(l);
60
+ } else if (dedans && /^\s*-\s+\S/.test(l)) {
61
+ out.push(l.trim());
62
+ }
60
63
  }
61
64
  return out;
62
65
  }
@@ -68,9 +71,14 @@ function section(description, titre) {
68
71
  let niveau = 0;
69
72
  for (const l of String(description ?? '').split('\n')) {
70
73
  const t = /^(#{1,6})\s+(.*)$/.exec(l);
71
- if (niveau && t && t[1].length <= niveau) break;
72
- if (niveau) out.push(l);
73
- else if (t && titre.test(t[2].trim())) niveau = t[1].length;
74
+ if (niveau && t && t[1].length <= niveau) {
75
+ break;
76
+ }
77
+ if (niveau) {
78
+ out.push(l);
79
+ } else if (t && titre.test(t[2].trim())) {
80
+ niveau = t[1].length;
81
+ }
74
82
  }
75
83
  return out.join('\n');
76
84
  }
@@ -108,7 +116,9 @@ function bdJson(principal, args) {
108
116
  encoding: 'utf8',
109
117
  maxBuffer: 256 * 1024 * 1024,
110
118
  });
111
- if (r.status !== 0) throw new Error(r.stderr || r.error?.message || `code ${r.status}`);
119
+ if (r.status !== 0) {
120
+ throw new Error(r.stderr || r.error?.message || `code ${r.status}`);
121
+ }
112
122
  return JSON.parse(r.stdout || '[]');
113
123
  }
114
124
 
@@ -117,11 +127,15 @@ function bdJson(principal, args) {
117
127
  // and plan read by bd from the main tree, judged by `juger`.
118
128
  export function verifier(racine, env = process.env) {
119
129
  const ticket = ticketDeLaCopie(racine);
120
- if (!ticket) return [];
130
+ if (!ticket) {
131
+ return [];
132
+ }
121
133
  const interfaces = [];
122
134
  for (const c of aVerifier(racine, env)) {
123
135
  const iface = path.join(c.dir, 'docs', 'INTERFACE.md');
124
- if (!existsSync(iface)) continue;
136
+ if (!existsSync(iface)) {
137
+ continue;
138
+ }
125
139
  const rel = path.relative(racine, iface);
126
140
  const head = git(racine, 'show', `HEAD:${rel}`);
127
141
  interfaces.push({
@@ -161,7 +175,9 @@ export function juger(ticket, interfaces, commentaires, ticketLu) {
161
175
  nomsAvant.set(l.consommateur, new Set([...(nomsAvant.get(l.consommateur) ?? []), ...l.noms]));
162
176
  }
163
177
  for (const ligne of lignesConsommateurs(apres)) {
164
- if (avant.has(ligne)) continue;
178
+ if (avant.has(ligne)) {
179
+ continue;
180
+ }
165
181
  const l = lireLigne(ligne);
166
182
  const lue = l?.noms ? l : null;
167
183
  const deja = lue && nomsAvant.get(lue.consommateur);
@@ -169,7 +185,9 @@ export function juger(ticket, interfaces, commentaires, ticketLu) {
169
185
  changees.push({ rel, ligne, lue, ajoutes });
170
186
  }
171
187
  }
172
- if (changees.length === 0) return [];
188
+ if (changees.length === 0) {
189
+ return [];
190
+ }
173
191
  let comments;
174
192
  try {
175
193
  comments = (commentaires() ?? []).map(x => ({ text: String(x.text ?? '') }));
@@ -185,7 +203,9 @@ export function juger(ticket, interfaces, commentaires, ticketLu) {
185
203
  const restantes = changees.filter(
186
204
  ({ ligne }) => !arbitrages.some(a => a.text.includes(consommateurDe(ligne)))
187
205
  );
188
- if (restantes.length === 0) return [];
206
+ if (restantes.length === 0) {
207
+ return [];
208
+ }
189
209
  // The lines no arbitrage settles: the ticket's plan, its title and its sections « Architecture »
190
210
  // and « Noms publiés ».
191
211
  let plan;
@@ -206,7 +226,9 @@ export function juger(ticket, interfaces, commentaires, ticketLu) {
206
226
  const constats = [];
207
227
  for (const { rel, ligne, lue, ajoutes } of restantes) {
208
228
  const manquants = lue ? nonNommes(plan, [lue.consommateur, ...ajoutes]) : null;
209
- if (manquants?.length === 0) continue;
229
+ if (manquants?.length === 0) {
230
+ continue;
231
+ }
210
232
  const consommateur = consommateurDe(ligne);
211
233
  const dit = manquants
212
234
  ? ` ; le plan ne nomme pas ${manquants.map(n => `\`${n}\``).join(', ')}`
@@ -223,7 +245,11 @@ export function juger(ticket, interfaces, commentaires, ticketLu) {
223
245
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
224
246
  const racine = process.cwd();
225
247
  const { refus, lignes } = trancher(racine, 'consommateurs-arbitres', verifier(racine));
226
- for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
227
- for (const l of lignes) process.stderr.write(`${l}\n`);
248
+ for (const r of refus) {
249
+ process.stderr.write(`⛔ ${r.message}\n`);
250
+ }
251
+ for (const l of lignes) {
252
+ process.stderr.write(`${l}\n`);
253
+ }
228
254
  process.exitCode = refus.length ? 1 : 0;
229
255
  }