@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
@@ -76,11 +76,17 @@ const lireJson = p => JSON.parse(readFileSync(p, 'utf8'));
76
76
  // has none.
77
77
  export function sansApi(c) {
78
78
  const pj = path.join(c.dir, 'package.json');
79
- if (!existsSync(pj)) return false;
79
+ if (!existsSync(pj)) {
80
+ return false;
81
+ }
80
82
  const p = lireJson(pj);
81
83
  const exp = p.exports;
82
- if (exp === undefined) return [p.main, p.types, p.typings].every(e => e === undefined);
83
- if (!exp || typeof exp !== 'object' || Array.isArray(exp)) return false;
84
+ if (exp === undefined) {
85
+ return [p.main, p.types, p.typings].every(e => e === undefined);
86
+ }
87
+ if (!exp || typeof exp !== 'object' || Array.isArray(exp)) {
88
+ return false;
89
+ }
84
90
  const cles = Object.keys(exp);
85
91
  return cles.length > 0 && cles.every(k => k.startsWith('.')) && !cles.includes('.');
86
92
  }
@@ -97,7 +103,9 @@ export function entree(racine, c) {
97
103
  }
98
104
  const racinePj = path.join(racine, 'package.json');
99
105
  const types = existsSync(racinePj) ? lireJson(racinePj).types : null;
100
- if (!types) return null;
106
+ if (!types) {
107
+ return null;
108
+ }
101
109
  return path.join(racine, path.dirname(types), path.basename(c.dir), 'index.d.ts');
102
110
  }
103
111
 
@@ -108,14 +116,22 @@ export function declare(texte) {
108
116
  let section = null;
109
117
  let bloc = false;
110
118
  for (const l of ecrite(texte)) {
111
- if (/^\s*(```|~~~)/.test(l)) bloc = !bloc;
119
+ if (/^\s*(```|~~~)/.test(l)) {
120
+ bloc = !bloc;
121
+ }
112
122
  const titre = !bloc && /^(#{2,3}) (.+)$/.exec(l);
113
123
  if (titre) {
114
124
  section = titre[1] === '##' ? titre[2].trim() : section;
115
- if (section === 'Les fautes' && fautes === null) fautes = new Set();
125
+ if (section === 'Les fautes' && fautes === null) {
126
+ fautes = new Set();
127
+ }
116
128
  continue;
117
129
  }
118
- if (section === 'Les fautes') for (const m of l.matchAll(CODE)) fautes.add(m[0]);
130
+ if (section === 'Les fautes') {
131
+ for (const m of l.matchAll(CODE)) {
132
+ fautes.add(m[0]);
133
+ }
134
+ }
119
135
  }
120
136
  return { fautes };
121
137
  }
@@ -131,7 +147,9 @@ function codesDuCode(dir, racine, prefixes) {
131
147
  ).filter(p => SOURCE.test(nom(p)) && !isTest(path.relative(racine, p)));
132
148
  for (const p of sources) {
133
149
  for (const m of (lireSiPresent(p) ?? '').matchAll(CODE)) {
134
- if (prefixes.some(pr => m[0].startsWith(pr))) trouves.add(m[0]);
150
+ if (prefixes.some(pr => m[0].startsWith(pr))) {
151
+ trouves.add(m[0]);
152
+ }
135
153
  }
136
154
  }
137
155
  return trouves;
@@ -214,7 +232,9 @@ const CODE_SEUL = new RegExp(`^${CODE.source}$`);
214
232
 
215
233
  // The text of a TSDoc node, its paragraphs apart by a blank line, each on one line.
216
234
  function texteDoc(noeud) {
217
- if (!noeud) return '';
235
+ if (!noeud) {
236
+ return '';
237
+ }
218
238
  const feuilles = n =>
219
239
  n.kind === 'Excerpt' ? n.content.toString() : n.getChildNodes().map(feuilles).join('');
220
240
  const paragraphes = noeud.kind === 'Section' ? noeud.getChildNodes() : [noeud];
@@ -287,7 +307,9 @@ function fautesJugees(nom, textes, fautes, refus, codes) {
287
307
  regle: 'faute-hors-catalogue',
288
308
  texte: `${nom} : le @faute ${code} n'est pas au catalogue « ## Les fautes ».`,
289
309
  });
290
- } else codes.add(code);
310
+ } else {
311
+ codes.add(code);
312
+ }
291
313
  }
292
314
  }
293
315
 
@@ -297,35 +319,42 @@ export function jugerExport(item, fautes) {
297
319
  const refus = [];
298
320
  const nom = `\`${item.displayName}\``;
299
321
  const k = contratDe(item);
300
- if (!k.resume) refus.push({ regle: 'resume', texte: `${nom} n'a pas de résumé TSDoc.` });
322
+ if (!k.resume) {
323
+ refus.push({ regle: 'resume', texte: `${nom} n'a pas de résumé TSDoc.` });
324
+ }
301
325
  const codes = new Set();
302
326
  if (estFonction(item)) {
303
327
  const noms = new Set(k.parametres.filter(p => !p.destructure).map(p => p.name));
304
328
  const prises = new Set();
305
329
  k.parametres.forEach((p, i) => {
306
330
  const parNom = p.destructure ? -1 : k.params.findIndex(b => b.nom === p.name);
307
- if (parNom >= 0) prises.add(parNom);
308
- else if (!p.destructure)
331
+ if (parNom >= 0) {
332
+ prises.add(parNom);
333
+ } else if (!p.destructure) {
309
334
  refus.push({
310
335
  regle: 'param',
311
336
  texte: `${nom} : le paramètre « ${p.name} » n'a pas de @param.`,
312
337
  });
313
- else if (!k.params[i] || noms.has(k.params[i].nom))
338
+ } else if (!k.params[i] || noms.has(k.params[i].nom)) {
314
339
  refus.push({
315
340
  regle: 'param',
316
341
  texte: `${nom} : le paramètre déstructuré en position ${i + 1} n'a pas son @param à cette position.`,
317
342
  });
318
- else prises.add(i);
343
+ } else {
344
+ prises.add(i);
345
+ }
319
346
  });
320
347
  k.params.forEach((b, i) => {
321
- if (!prises.has(i))
348
+ if (!prises.has(i)) {
322
349
  refus.push({
323
350
  regle: 'param-orphelin',
324
351
  texte: `${nom} : le @param « ${b.nom} » ne nomme aucun paramètre.`,
325
352
  });
353
+ }
326
354
  });
327
- if (k.rendUneValeur && k.retour === null)
355
+ if (k.rendUneValeur && k.retour === null) {
328
356
  refus.push({ regle: 'returns', texte: `${nom} rend une valeur mais n'a pas de @returns.` });
357
+ }
329
358
  }
330
359
  fautesJugees(nom, k.fautes, fautes, refus, codes);
331
360
  for (const m of item.members ?? []) {
@@ -350,19 +379,28 @@ export function marques(texte) {
350
379
  lignes.forEach((l, i) => {
351
380
  const f = /^\s*(```|~~~)/.exec(l);
352
381
  if (cloture) {
353
- if (f && f[1] === cloture) cloture = null;
382
+ if (f && f[1] === cloture) {
383
+ cloture = null;
384
+ }
354
385
  return;
355
386
  }
356
387
  if (f) {
357
388
  cloture = f[1];
358
389
  return;
359
390
  }
360
- if (l.trim() === DEBUT) debuts.push(i);
361
- if (l.trim() === FIN) fins.push(i);
391
+ if (l.trim() === DEBUT) {
392
+ debuts.push(i);
393
+ }
394
+ if (l.trim() === FIN) {
395
+ fins.push(i);
396
+ }
362
397
  });
363
- if (!debuts.length && !fins.length) return { etat: 'absentes', lignes };
364
- if (debuts.length === 1 && fins.length === 1 && debuts[0] < fins[0])
398
+ if (!debuts.length && !fins.length) {
399
+ return { etat: 'absentes', lignes };
400
+ }
401
+ if (debuts.length === 1 && fins.length === 1 && debuts[0] < fins[0]) {
365
402
  return { etat: 'ok', lignes, debut: debuts[0], fin: fins[0] };
403
+ }
366
404
  return { etat: 'invalides', lignes };
367
405
  }
368
406
 
@@ -379,10 +417,12 @@ const signature = item => {
379
417
  /^(?:(?:export|declare|default|async)\s+)*(?:function|class|interface|type|enum|namespace|const|let|var)\b/.test(
380
418
  texte
381
419
  )
382
- )
420
+ ) {
383
421
  return texte;
384
- if (item.kind === 'Variable')
422
+ }
423
+ if (item.kind === 'Variable') {
385
424
  return `export declare ${item.isReadonly ? 'const' : 'let'} ${texte}`;
425
+ }
386
426
  return item.kind === 'Function' ? `const ${texte}` : texte;
387
427
  };
388
428
 
@@ -391,15 +431,21 @@ const signature = item => {
391
431
  function entreeDe(item) {
392
432
  const k = contratDe(item);
393
433
  const out = [`### \`${item.displayName}\``, ''];
394
- if (k.resume) out.push(k.resume, '');
434
+ if (k.resume) {
435
+ out.push(k.resume, '');
436
+ }
395
437
  out.push('```ts', `${signature(item)};`, '```');
396
438
  const params = k.params.filter(b => b.texte);
397
- if (params.length)
439
+ if (params.length) {
398
440
  out.push('', '**Paramètres**', '', ...params.map(b => `- \`${b.nom}\` — ${b.texte}`));
399
- if (k.retour) out.push('', `**Retour** — ${k.retour}`);
441
+ }
442
+ if (k.retour) {
443
+ out.push('', `**Retour** — ${k.retour}`);
444
+ }
400
445
  const codes = [...new Set(k.fautes.map(f => f.replace(/\s+/g, ' ')))];
401
- if (codes.length)
446
+ if (codes.length) {
402
447
  out.push('', '**Fautes**', '', ...codes.map(f => `- ${f.replace(/^(\S+)/, '`$1`')}`));
448
+ }
403
449
  const membres = [...(item.members ?? [])];
404
450
  if (membres.length) {
405
451
  out.push('', '**Membres**', '');
@@ -418,8 +464,9 @@ export const partieGeneree = exports =>
418
464
  // The text of an interface with its generated part replaced; the marks are added at the end of a
419
465
  // text that has none.
420
466
  export function avecPartie(m, texte, partie) {
421
- if (m.etat === 'absentes')
467
+ if (m.etat === 'absentes') {
422
468
  return `${texte}${texte.endsWith('\n') ? '' : '\n'}\n${DEBUT}${partie}${FIN}\n`;
469
+ }
423
470
  const avant = m.lignes.slice(0, m.debut).join('\n');
424
471
  const apres = m.lignes.slice(m.fin + 1).join('\n');
425
472
  return `${avant}${m.debut ? '\n' : ''}${DEBUT}${partie}${FIN}\n${apres}`;
@@ -456,7 +503,9 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
456
503
  const { fautes } = declare(texte);
457
504
  const m = marques(texte);
458
505
  if (sansApi(c)) {
459
- if (fautes) codesContreCatalogue(c, racine, fautes, refuser);
506
+ if (fautes) {
507
+ codesContreCatalogue(c, racine, fautes, refuser);
508
+ }
460
509
  return { refus, signaux };
461
510
  }
462
511
  if (m.etat === 'invalides') {
@@ -474,7 +523,9 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
474
523
  const { TSDocConfigFile } = require('@microsoft/tsdoc-config');
475
524
  const config = TSDocConfigFile.loadFile(fichierTsdoc);
476
525
  const api = rapportApi(racine, c, dts, ecrire, config);
477
- for (const msg of api.messages) signaux.push(`${rel} : ${msg}`);
526
+ for (const msg of api.messages) {
527
+ signaux.push(`${rel} : ${msg}`);
528
+ }
478
529
  for (const t of api.tsdoc) {
479
530
  refuser(`TSDoc : ${t.texte}`, t.regle, t.fichier ?? relIface, t.ligne);
480
531
  }
@@ -493,17 +544,24 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
493
544
  const nommees = new Set();
494
545
  for (const item of api.exports) {
495
546
  const j = jugerExport(item, fautes);
496
- for (const r of j.refus) refuser(r.texte, r.regle);
497
- for (const code of j.codes) nommees.add(code);
547
+ for (const r of j.refus) {
548
+ refuser(r.texte, r.regle);
549
+ }
550
+ for (const code of j.codes) {
551
+ nommees.add(code);
552
+ }
498
553
  }
499
554
  for (const f of fautes ?? []) {
500
- if (!nommees.has(f))
555
+ if (!nommees.has(f)) {
501
556
  refuser(`la faute ${f} du catalogue n'est nommée par aucun @faute.`, 'faute-non-nommee');
557
+ }
502
558
  }
503
559
  if (m.etat !== 'invalides') {
504
560
  const attendu = avecPartie(m, texte, partieGeneree(api.exports));
505
561
  if (ecrire) {
506
- if (attendu !== texte) writeFileSync(iface, attendu);
562
+ if (attendu !== texte) {
563
+ writeFileSync(iface, attendu);
564
+ }
507
565
  } else if (attendu !== texte) {
508
566
  aRegenerer(
509
567
  `la part générée de docs/INTERFACE.md (entre ${DEBUT} et ${FIN}) n'est pas celle du code ; npm run api la refait.`,
@@ -512,7 +570,9 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
512
570
  }
513
571
  }
514
572
  }
515
- if (fautes) codesContreCatalogue(c, racine, fautes, refuser);
573
+ if (fautes) {
574
+ codesContreCatalogue(c, racine, fautes, refuser);
575
+ }
516
576
  return { refus, signaux };
517
577
  }
518
578
 
@@ -522,12 +582,14 @@ function codesContreCatalogue(c, racine, fautes, refuser) {
522
582
  const prefixes = [...new Set([...fautes].map(f => f.slice(0, f.indexOf('_') + 1)))];
523
583
  const dansLeCode = codesDuCode(c.dir, racine, prefixes);
524
584
  for (const f of fautes) {
525
- if (!dansLeCode.has(f))
585
+ if (!dansLeCode.has(f)) {
526
586
  refuser(`la faute ${f} est listée, mais le code ne la produit pas.`, 'faute-non-produite');
587
+ }
527
588
  }
528
589
  for (const f of dansLeCode) {
529
- if (!fautes.has(f))
590
+ if (!fautes.has(f)) {
530
591
  refuser(`le code produit ${f}, que « Les fautes » ne liste pas.`, 'faute-non-listee');
592
+ }
531
593
  }
532
594
  }
533
595
 
@@ -546,11 +608,17 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
546
608
  const constats = [];
547
609
  for (const c of aVerifier(racine)) {
548
610
  const { refus, signaux } = verifierComposant(racine, c, { ecrire });
549
- for (const s of signaux) process.stderr.write(`⚠️ ${s}\n`);
611
+ for (const s of signaux) {
612
+ process.stderr.write(`⚠️ ${s}\n`);
613
+ }
550
614
  constats.push(...refus);
551
615
  }
552
616
  const { refus, lignes } = trancher(racine, 'interfaces-contre-code', constats);
553
- for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
554
- for (const l of lignes) process.stderr.write(`${l}\n`);
617
+ for (const r of refus) {
618
+ process.stderr.write(`⛔ ${r.message}\n`);
619
+ }
620
+ for (const l of lignes) {
621
+ process.stderr.write(`${l}\n`);
622
+ }
555
623
  process.exitCode = refus.length ? 1 : 0;
556
624
  }
@@ -41,7 +41,9 @@ function sourcesDe(tous) {
41
41
  return tous.flatMap(c =>
42
42
  parcourir(c.dir, p => SAUTES.has(path.basename(p)))
43
43
  .filter(f => {
44
- if (!SOURCE.test(f) || NOM_DE_TEST.test(path.basename(f))) return false;
44
+ if (!SOURCE.test(f) || NOM_DE_TEST.test(path.basename(f))) {
45
+ return false;
46
+ }
45
47
  return !path
46
48
  .relative(c.dir, f)
47
49
  .split(path.sep)
@@ -56,7 +58,9 @@ function interfacesDe(racine, tous) {
56
58
  const out = new Map();
57
59
  for (const c of tous) {
58
60
  const f = path.join(c.dir, 'docs', 'INTERFACE.md');
59
- if (!existsSync(f)) continue;
61
+ if (!existsSync(f)) {
62
+ continue;
63
+ }
60
64
  const i = lire(path.relative(racine, f).split(path.sep).join('/'), readFileSync(f, 'utf8'));
61
65
  const publies = new Set(
62
66
  i.parties.filter(p => !p.consommateurs).map(p => p.titre.replace(/`/g, '').trim())
@@ -71,7 +75,9 @@ function interfacesDe(racine, tous) {
71
75
  // files left out.
72
76
  function testsDe(c) {
73
77
  return parcourir(c.dir, p => SAUTES.has(path.basename(p))).filter(f => {
74
- if (!SOURCE.test(f)) return false;
78
+ if (!SOURCE.test(f)) {
79
+ return false;
80
+ }
75
81
  const rel = path.relative(c.dir, f).split(path.sep);
76
82
  return NOM_DE_TEST.test(path.basename(f)) || rel.some(d => DOSSIERS_DE_TEST.has(d));
77
83
  });
@@ -102,11 +108,12 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
102
108
  const ifaces = interfacesDe(racine, tous);
103
109
  const tests = new Map();
104
110
  const testsDuComposant = c => {
105
- if (!tests.has(c))
111
+ if (!tests.has(c)) {
106
112
  tests.set(
107
113
  c,
108
114
  testsDe(c).map(f => ({ f, texte: lireSiPresent(f) ?? '' }))
109
115
  );
116
+ }
110
117
  return tests.get(c);
111
118
  };
112
119
  const elements = [];
@@ -114,25 +121,35 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
114
121
  for (const nom of noms) {
115
122
  const fournisseurs = tous.filter(c => ifaces.get(c)?.publies.has(nom));
116
123
  if (fournisseurs.length === 0) {
117
- if (!tous.some(c => c.paquet === nom)) sansFournisseur.push(nom);
124
+ if (!tous.some(c => c.paquet === nom)) {
125
+ sansFournisseur.push(nom);
126
+ }
118
127
  continue;
119
128
  }
120
129
  for (const p of fournisseurs) {
121
130
  const lus = [];
122
131
  for (const c of tous) {
123
- if (c === p) continue;
132
+ if (c === p) {
133
+ continue;
134
+ }
124
135
  const par = [];
125
136
  const declare =
126
137
  ifaces.get(p).consommateurs.get(c.nom) ?? ifaces.get(p).consommateurs.get(c.paquet);
127
- if (declare && (declare.has(nom) || declare.has('*'))) par.push('consommateurs');
138
+ if (declare && (declare.has(nom) || declare.has('*'))) {
139
+ par.push('consommateurs');
140
+ }
128
141
  const n = reel.get(p.nom)?.get(c.nom);
129
- if (n && (n.has(nom) || n.has('*'))) par.push('import');
142
+ if (n && (n.has(nom) || n.has('*'))) {
143
+ par.push('import');
144
+ }
130
145
  for (const t of testsDuComposant(c)) {
131
146
  if (identifiant(nom).test(t.texte) && importe(t.texte, t.f, p)) {
132
147
  par.push(path.relative(racine, t.f).split(path.sep).join('/'));
133
148
  }
134
149
  }
135
- if (par.length) lus.push({ composant: exterieur(c), par });
150
+ if (par.length) {
151
+ lus.push({ composant: exterieur(c), par });
152
+ }
136
153
  }
137
154
  elements.push({ nom, fournisseur: exterieur(p), lecteurs: lus });
138
155
  }
@@ -149,10 +166,18 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
149
166
  const lit = new Map(composants.map(c => [c, new Set()]));
150
167
  for (const p of tous) {
151
168
  for (const nomLecteur of reel.get(p.nom)?.keys() ?? []) {
152
- for (const c of tous) if (c.nom === nomLecteur) lit.get(c.c).add(p.c);
169
+ for (const c of tous) {
170
+ if (c.nom === nomLecteur) {
171
+ lit.get(c.c).add(p.c);
172
+ }
173
+ }
174
+ }
175
+ }
176
+ for (const e of elements) {
177
+ for (const l of e.lecteurs) {
178
+ lit.get(l.composant).add(e.fournisseur);
153
179
  }
154
180
  }
155
- for (const e of elements) for (const l of e.lecteurs) lit.get(l.composant).add(e.fournisseur);
156
181
  const parLesTests = new Map(composants.map(c => [c, new Set()]));
157
182
  for (const [c, lus] of testsLisent) {
158
183
  for (const p of lus) {
@@ -53,14 +53,18 @@ export function migrer(projet) {
53
53
  }
54
54
  }
55
55
  const fracine = path.join(projet, 'package.json');
56
- if (!existsSync(fracine)) return lignes;
56
+ if (!existsSync(fracine)) {
57
+ return lignes;
58
+ }
57
59
  const racine = lireJson(fracine);
58
60
  const plage =
59
61
  CHAMPS.map(c => racine[c]?.[PAQUET]).find(v => v !== undefined) ?? `^${versionDuCadre()}`;
60
62
  const declarer = pkg => {
61
63
  let change = false;
62
64
  for (const c of CHAMPS) {
63
- if (pkg[c]?.[ANCIEN] === undefined) continue;
65
+ if (pkg[c]?.[ANCIEN] === undefined) {
66
+ continue;
67
+ }
64
68
  const { [ANCIEN]: _ancien, ...reste } = pkg[c];
65
69
  const deja = CHAMPS.some(d => pkg[d]?.[PAQUET] !== undefined);
66
70
  pkg[c] = Object.fromEntries(
@@ -73,12 +77,16 @@ export function migrer(projet) {
73
77
  return change;
74
78
  };
75
79
  for (const { dossier, pkg } of paquets(projet)) {
76
- if (ANCIENS_ESPACES.includes(dossier) || !declarer(pkg)) continue;
80
+ if (ANCIENS_ESPACES.includes(dossier) || !declarer(pkg)) {
81
+ continue;
82
+ }
77
83
  ecrireJson(path.join(projet, dossier, 'package.json'), pkg);
78
84
  lignes.push(`${dossier}/package.json : déclare ${PAQUET} à la place de ${ANCIEN}`);
79
85
  }
80
86
  const declare = declarer(racine);
81
- if (declare) lignes.push(`package.json : déclare ${PAQUET} à la place de ${ANCIEN}`);
87
+ if (declare) {
88
+ lignes.push(`package.json : déclare ${PAQUET} à la place de ${ANCIEN}`);
89
+ }
82
90
  const liste = Array.isArray(racine.workspaces) ? racine.workspaces : racine.workspaces?.packages;
83
91
  const restants = Array.isArray(liste) ? liste.filter(e => !ANCIENS_ESPACES.includes(e)) : liste;
84
92
  const espaces = Array.isArray(liste) && restants.length !== liste.length;
@@ -88,6 +96,8 @@ export function migrer(projet) {
88
96
  : { ...racine.workspaces, packages: restants };
89
97
  lignes.push(`package.json : l'ancien dossier de ${ANCIEN} quitte les workspaces`);
90
98
  }
91
- if (declare || espaces) ecrireJson(fracine, racine);
99
+ if (declare || espaces) {
100
+ ecrireJson(fracine, racine);
101
+ }
92
102
  return lignes;
93
103
  }
@@ -17,9 +17,13 @@ export const nom = 'chemins des tests';
17
17
 
18
18
  /** Inscribes the paths the tests of the project at <projet> name undeclared; what it did. */
19
19
  export function migrer(projet) {
20
- if (lire(projet)[GARDE]) return [];
20
+ if (lire(projet)[GARDE]) {
21
+ return [];
22
+ }
21
23
  const constats = verifier(projet);
22
- if (constats.length === 0) return [];
24
+ if (constats.length === 0) {
25
+ return [];
26
+ }
23
27
  trancher(projet, GARDE, constats, 'inscrire', {});
24
28
  return [
25
29
  `${FICHIER} : ${constats.length} chemin(s) qu'un test nomme sans que le cadre le lise, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chaque test écrit le chemin entier`,
@@ -21,9 +21,13 @@ export const nom = 'tailles des tests';
21
21
 
22
22
  /** Inscribes the large tests of the day of the project at <projet> in its debt; what it did. */
23
23
  export function migrer(projet) {
24
- if (lire(projet)[GARDE]) return [];
24
+ if (lire(projet)[GARDE]) {
25
+ return [];
26
+ }
25
27
  const constats = verifier(projet);
26
- if (constats.length === 0) return [];
28
+ if (constats.length === 0) {
29
+ return [];
30
+ }
27
31
  trancher(projet, GARDE, constats, 'inscrire', {});
28
32
  return [
29
33
  `${FICHIER} : ${constats.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (*.nuit.test.*) ou se réduit`,
@@ -22,7 +22,9 @@ export function migrer(projet) {
22
22
  const inscrite = lire(projet)[GARDE] ?? {};
23
23
  const constats = verifier(projet);
24
24
  const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
25
- if (neufs.length === 0) return [];
25
+ if (neufs.length === 0) {
26
+ return [];
27
+ }
26
28
  // Inscribed counts stay; a finding without key is added at its count.
27
29
  trancher(projet, GARDE, constats, 'inscrire', {});
28
30
  return [
@@ -15,7 +15,9 @@ function siPresent(lire, f, absent) {
15
15
  try {
16
16
  return lire(f);
17
17
  } catch (e) {
18
- if (e?.code === 'ENOENT') return absent;
18
+ if (e?.code === 'ENOENT') {
19
+ return absent;
20
+ }
19
21
  throw e;
20
22
  }
21
23
  }
@@ -32,16 +34,22 @@ export function parcourir(chemin, sauter = () => false) {
32
34
  const out = [];
33
35
  const walk = (p, dossier) => {
34
36
  if (!dossier) {
35
- if (!TEMPORAIRE_DE_VITE.test(p)) out.push(p);
37
+ if (!TEMPORAIRE_DE_VITE.test(p)) {
38
+ out.push(p);
39
+ }
36
40
  return;
37
41
  }
38
42
  for (const e of siPresent(d => readdirSync(d, { withFileTypes: true }), p, [])) {
39
43
  const q = path.join(p, e.name);
40
- if (!sauter(q)) walk(q, e.isDirectory());
44
+ if (!sauter(q)) {
45
+ walk(q, e.isDirectory());
46
+ }
41
47
  }
42
48
  };
43
49
  const racine = siPresent(statSync, chemin, null);
44
- if (racine) walk(chemin, racine.isDirectory());
50
+ if (racine) {
51
+ walk(chemin, racine.isDirectory());
52
+ }
45
53
  return out;
46
54
  }
47
55
 
@@ -55,7 +55,9 @@ export function estUnTest(chemin, racine) {
55
55
  // of its file's kind (`.nuit` or `.budget` kept before `.test`);
56
56
  // null for a file Vitest does not play.
57
57
  export function soeurDAvant(chemin, racine) {
58
- if (!estUnTest(chemin, racine)?.joue) return null;
58
+ if (!estUnTest(chemin, racine)?.joue) {
59
+ return null;
60
+ }
59
61
  return chemin.replace(/((?:\.nuit|\.budget)?\.(?:test|spec)\.[cm]?[jt]sx?)$/, '.circuit-avant$1');
60
62
  }
61
63
 
@@ -67,7 +69,9 @@ const DES_TESTS = 'devDependencies';
67
69
  // manifest of no package.
68
70
  function horsDesTests(chemin, racine, avant, apres) {
69
71
  const abs = path.resolve(racine, chemin);
70
- if (!dossiers(racine).some(d => path.join(d.dir, 'package.json') === abs)) return null;
72
+ if (!dossiers(racine).some(d => path.join(d.dir, 'package.json') === abs)) {
73
+ return null;
74
+ }
71
75
  const lire = texte => {
72
76
  try {
73
77
  const v = texte === null ? {} : JSON.parse(texte);
@@ -79,7 +83,9 @@ function horsDesTests(chemin, racine, avant, apres) {
79
83
  }
80
84
  };
81
85
  const [a, b] = [lire(avant), lire(apres)];
82
- if (a.faute || b.faute) return [a.faute ?? b.faute];
86
+ if (a.faute || b.faute) {
87
+ return [a.faute ?? b.faute];
88
+ }
83
89
  return [...new Set([...Object.keys(a.valeur), ...Object.keys(b.valeur)])]
84
90
  .filter(k => k !== DES_TESTS && !isDeepStrictEqual(a.valeur[k], b.valeur[k]))
85
91
  .sort();
@@ -32,7 +32,9 @@ export function verifier(racine, env = process.env) {
32
32
  const constats = [];
33
33
  for (const c of aVerifier(racine, env)) {
34
34
  const iface = path.join(c.dir, 'docs', 'INTERFACE.md');
35
- if (!existsSync(iface)) continue;
35
+ if (!existsSync(iface)) {
36
+ continue;
37
+ }
36
38
  const relIface = path.relative(racine, iface);
37
39
  const longs = lire(relIface, readFileSync(iface, 'utf8')).parties.filter(
38
40
  p => p.titre && [...p.phrase].length > LONGUEUR_MAX
@@ -51,7 +53,11 @@ export function verifier(racine, env = process.env) {
51
53
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
52
54
  const racine = process.cwd();
53
55
  const { refus, lignes } = trancher(racine, 'resumes', verifier(racine));
54
- for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
55
- for (const l of lignes) process.stderr.write(`${l}\n`);
56
+ for (const r of refus) {
57
+ process.stderr.write(`⛔ ${r.message}\n`);
58
+ }
59
+ for (const l of lignes) {
60
+ process.stderr.write(`${l}\n`);
61
+ }
56
62
  process.exitCode = refus.length ? 1 : 0;
57
63
  }