@roomi-fields/grillhouse 0.29.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 (263) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +769 -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/bin/grillhouse.mjs +79 -18
  8. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  9. package/cadre/templates/projet/CLAUDE.md +5 -1
  10. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  11. package/cadre/templates/projet/package.json +2 -2
  12. package/charte.md +24 -0
  13. package/dist/temporal/acte.d.ts +24 -0
  14. package/dist/temporal/acte.js +139 -0
  15. package/dist/temporal/acte.js.map +1 -0
  16. package/dist/temporal/attributs.d.ts +6 -0
  17. package/dist/temporal/attributs.js +15 -0
  18. package/dist/temporal/attributs.js.map +1 -0
  19. package/dist/temporal/circuit/activites.d.ts +13 -0
  20. package/dist/temporal/circuit/activites.js +33 -0
  21. package/dist/temporal/circuit/activites.js.map +1 -0
  22. package/dist/temporal/circuit/client.d.ts +72 -0
  23. package/dist/temporal/circuit/client.js +247 -0
  24. package/dist/temporal/circuit/client.js.map +1 -0
  25. package/dist/temporal/circuit/commande.d.ts +2 -0
  26. package/dist/temporal/circuit/commande.js +238 -0
  27. package/dist/temporal/circuit/commande.js.map +1 -0
  28. package/dist/temporal/circuit/contrat.d.ts +305 -0
  29. package/dist/temporal/circuit/contrat.js +30 -0
  30. package/dist/temporal/circuit/contrat.js.map +1 -0
  31. package/dist/temporal/circuit/deroule.d.ts +3 -0
  32. package/dist/temporal/circuit/deroule.js +540 -0
  33. package/dist/temporal/circuit/deroule.js.map +1 -0
  34. package/dist/temporal/client.d.ts +47 -0
  35. package/dist/temporal/client.js +69 -0
  36. package/dist/temporal/client.js.map +1 -0
  37. package/dist/temporal/commande.d.ts +2 -0
  38. package/dist/temporal/commande.js +94 -0
  39. package/dist/temporal/commande.js.map +1 -0
  40. package/dist/temporal/deroules.d.ts +5 -0
  41. package/dist/temporal/deroules.js +10 -0
  42. package/dist/temporal/deroules.js.map +1 -0
  43. package/dist/temporal/etat.d.ts +33 -0
  44. package/dist/temporal/etat.js +59 -0
  45. package/dist/temporal/etat.js.map +1 -0
  46. package/dist/temporal/file/activites.d.ts +10 -0
  47. package/dist/temporal/file/activites.js +25 -0
  48. package/dist/temporal/file/activites.js.map +1 -0
  49. package/dist/temporal/file/client.d.ts +4 -0
  50. package/dist/temporal/file/client.js +6 -0
  51. package/dist/temporal/file/client.js.map +1 -0
  52. package/dist/temporal/file/contrat.d.ts +158 -0
  53. package/dist/temporal/file/contrat.js +14 -0
  54. package/dist/temporal/file/contrat.js.map +1 -0
  55. package/dist/temporal/file/deroule.d.ts +15 -0
  56. package/dist/temporal/file/deroule.js +235 -0
  57. package/dist/temporal/file/deroule.js.map +1 -0
  58. package/dist/temporal/installation.d.ts +120 -0
  59. package/dist/temporal/installation.js +386 -0
  60. package/dist/temporal/installation.js.map +1 -0
  61. package/dist/temporal/places/activites.d.ts +8 -0
  62. package/dist/temporal/places/activites.js +13 -0
  63. package/dist/temporal/places/activites.js.map +1 -0
  64. package/dist/temporal/places/client.d.ts +28 -0
  65. package/dist/temporal/places/client.js +64 -0
  66. package/dist/temporal/places/client.js.map +1 -0
  67. package/dist/temporal/places/contrat.d.ts +106 -0
  68. package/dist/temporal/places/contrat.js +21 -0
  69. package/dist/temporal/places/contrat.js.map +1 -0
  70. package/dist/temporal/places/deroule.d.ts +3 -0
  71. package/dist/temporal/places/deroule.js +198 -0
  72. package/dist/temporal/places/deroule.js.map +1 -0
  73. package/dist/temporal/sonde/activites.d.ts +6 -0
  74. package/dist/temporal/sonde/activites.js +52 -0
  75. package/dist/temporal/sonde/activites.js.map +1 -0
  76. package/dist/temporal/sonde/contrat.d.ts +35 -0
  77. package/dist/temporal/sonde/contrat.js +10 -0
  78. package/dist/temporal/sonde/contrat.js.map +1 -0
  79. package/dist/temporal/sonde/deroule.d.ts +3 -0
  80. package/dist/temporal/sonde/deroule.js +39 -0
  81. package/dist/temporal/sonde/deroule.js.map +1 -0
  82. package/dist/temporal/tickets/activites.d.ts +7 -0
  83. package/dist/temporal/tickets/activites.js +81 -0
  84. package/dist/temporal/tickets/activites.js.map +1 -0
  85. package/dist/temporal/tickets/client.d.ts +10 -0
  86. package/dist/temporal/tickets/client.js +31 -0
  87. package/dist/temporal/tickets/client.js.map +1 -0
  88. package/dist/temporal/tickets/contrat.d.ts +56 -0
  89. package/dist/temporal/tickets/contrat.js +13 -0
  90. package/dist/temporal/tickets/contrat.js.map +1 -0
  91. package/dist/temporal/tickets/deroule.d.ts +3 -0
  92. package/dist/temporal/tickets/deroule.js +94 -0
  93. package/dist/temporal/tickets/deroule.js.map +1 -0
  94. package/dist/temporal/travailleur.d.ts +2 -0
  95. package/dist/temporal/travailleur.js +69 -0
  96. package/dist/temporal/travailleur.js.map +1 -0
  97. package/docs/ARCHITECTURE.md +646 -87
  98. package/docs/CADRE.md +27 -0
  99. package/docs/INTERFACE.md +139 -42
  100. package/hooks/crochet.mjs +19 -2
  101. package/hooks/hooks.json +11 -0
  102. package/package.json +16 -4
  103. package/scripts/activites.mjs +2255 -0
  104. package/scripts/aiguillage.d.mts +37 -0
  105. package/scripts/aiguillage.mjs +40 -14
  106. package/scripts/avancement.mjs +155 -26
  107. package/scripts/bilan.mjs +137 -43
  108. package/scripts/cadre.mjs +16 -4
  109. package/scripts/circuit.mjs +993 -4075
  110. package/scripts/circuits-cles.d.mts +4 -0
  111. package/scripts/circuits-cles.mjs +21 -0
  112. package/scripts/circuits-du-serveur.mjs +105 -0
  113. package/scripts/codes-de-sortie.mjs +9 -0
  114. package/scripts/commandes-composees.mjs +45 -41
  115. package/scripts/commandes-du-path.d.mts +7 -0
  116. package/scripts/commandes-du-path.mjs +25 -0
  117. package/scripts/composants-affectes.mjs +64 -21
  118. package/scripts/composition-des-langages.mjs +18 -12
  119. package/scripts/conformite.mjs +56 -28
  120. package/scripts/copies-finies.mjs +52 -47
  121. package/scripts/depart-du-ticket.d.mts +53 -0
  122. package/scripts/depart-du-ticket.mjs +124 -0
  123. package/scripts/dependances-internes.mjs +121 -0
  124. package/scripts/dernier-vert.mjs +61 -34
  125. package/scripts/dette.mjs +32 -11
  126. package/scripts/donnees-cles.mjs +244 -0
  127. package/scripts/droits.mjs +51 -16
  128. package/scripts/effets.mjs +352 -0
  129. package/scripts/empreinte-d-etape.mjs +17 -0
  130. package/scripts/engendres.mjs +15 -5
  131. package/scripts/enveloppe/enveloppe.mjs +259 -55
  132. package/scripts/enveloppe/lancer.sh +14 -18
  133. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  134. package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
  135. package/scripts/etapes.mjs +5 -2
  136. package/scripts/faits-du-circuit.mjs +493 -0
  137. package/scripts/file-des-tickets.d.mts +21 -0
  138. package/scripts/file-des-tickets.mjs +58 -0
  139. package/scripts/flux-des-paquets.mjs +201 -0
  140. package/scripts/gardes-du-cadre.mjs +21 -5
  141. package/scripts/init.mjs +11 -4
  142. package/scripts/integration/file.mjs +544 -434
  143. package/scripts/integration/integrer.mjs +87 -43
  144. package/scripts/integration/rejeu.mjs +45 -13
  145. package/scripts/jointure.d.ts +151 -28
  146. package/scripts/langages/cargo/commandes.mjs +383 -124
  147. package/scripts/langages/cargo/composants.mjs +154 -42
  148. package/scripts/langages/cargo/exemples.mjs +12 -21
  149. package/scripts/langages/cargo/index.mjs +22 -8
  150. package/scripts/langages/cargo/sccache.mjs +8 -14
  151. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  152. package/scripts/langages/python/commandes.mjs +218 -100
  153. package/scripts/langages/python/composants.mjs +53 -21
  154. package/scripts/langages/python/exemples.mjs +6 -16
  155. package/scripts/langages/python/index.mjs +28 -8
  156. package/scripts/langages/python/lot.mjs +1 -36
  157. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  158. package/scripts/langages/typescript/composants.mjs +9 -3
  159. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  160. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  161. package/scripts/langages/typescript/construire.mjs +6 -163
  162. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  163. package/scripts/langages/typescript/exemples.mjs +3 -11
  164. package/scripts/langages/typescript/frontieres.mjs +66 -22
  165. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  166. package/scripts/langages/typescript/index.mjs +50 -61
  167. package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
  168. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  169. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  170. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  171. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  172. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  173. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
  174. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  175. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  176. package/scripts/langages/typescript/parcours.mjs +12 -4
  177. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  178. package/scripts/langages/typescript/resumes.mjs +9 -3
  179. package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
  180. package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
  181. package/scripts/langages/typescript/tests.mjs +40 -15
  182. package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
  183. package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
  184. package/scripts/langages/typescript/verdict.mjs +4 -2
  185. package/scripts/langages/typescript/verifier.mjs +58 -20
  186. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  187. package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
  188. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  189. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  190. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  191. package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
  192. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  193. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
  194. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
  195. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  196. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
  197. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  198. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  199. package/scripts/lint-des-scripts.mjs +58 -0
  200. package/scripts/mesure/base-de-passe.mjs +117 -25
  201. package/scripts/mesure/pression.mjs +12 -6
  202. package/scripts/mesure-de-la-machine.d.mts +21 -0
  203. package/scripts/mesure-de-la-machine.mjs +76 -0
  204. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  205. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  206. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  207. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
  208. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  209. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  210. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
  211. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  212. package/scripts/migrations.mjs +5 -0
  213. package/scripts/nuit.sh +25 -3
  214. package/scripts/outil.mjs +3 -1
  215. package/scripts/outils-cles.d.mts +24 -0
  216. package/scripts/outils-cles.mjs +18 -8
  217. package/scripts/paquet-npm.mjs +157 -0
  218. package/scripts/paquet.mjs +73 -4
  219. package/scripts/paquets.mjs +46 -10
  220. package/scripts/passe-de-la-machine.mjs +71 -0
  221. package/scripts/places-de-la-machine.mjs +414 -0
  222. package/scripts/places-du-serveur.mjs +170 -0
  223. package/scripts/prefixe-des-tickets.mjs +68 -0
  224. package/scripts/preparation.mjs +25 -8
  225. package/scripts/registre.mjs +9 -4
  226. package/scripts/regles-des-places.d.mts +36 -0
  227. package/scripts/regles-des-places.mjs +70 -0
  228. package/scripts/reponses-du-circuit.d.mts +6 -0
  229. package/scripts/reponses-du-circuit.mjs +28 -0
  230. package/scripts/reprise.mjs +66 -0
  231. package/scripts/resultats.mjs +112 -46
  232. package/scripts/retirer-les-copies-finies.mjs +25 -0
  233. package/scripts/sans-reponse.d.mts +4 -0
  234. package/scripts/sans-reponse.mjs +13 -0
  235. package/scripts/seances.mjs +936 -0
  236. package/scripts/services-du-noyau.mjs +27 -8
  237. package/scripts/session-start.sh +2 -2
  238. package/scripts/sortie.mjs +3 -3
  239. package/scripts/sous-commandes.mjs +41 -10
  240. package/scripts/style-a-l-ecriture.mjs +260 -0
  241. package/scripts/superviseur.mjs +122 -111
  242. package/scripts/tableau.mjs +180 -117
  243. package/scripts/taches-du-graphe.mjs +348 -0
  244. package/scripts/ticket-du-circuit.mjs +216 -0
  245. package/scripts/transitions.d.mts +148 -0
  246. package/scripts/transitions.mjs +1018 -0
  247. package/scripts/verrou-de-fichier.mjs +8 -4
  248. package/scripts/verrou-de-machine.mjs +150 -51
  249. package/scripts/verrous/commande.mjs +50 -17
  250. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  251. package/scripts/verrous/verrou.mjs +42 -14
  252. package/skills/explorateur/SKILL.md +9 -2
  253. package/skills/grill/SKILL.md +1 -1
  254. package/skills/mesure/SKILL.md +3 -0
  255. package/skills/pitmaster/SKILL.md +17 -18
  256. package/skills/pitmaster/references/consigne-agent.md +5 -1
  257. package/skills/release/SKILL.md +3 -3
  258. package/skills/relecteur/SKILL.md +5 -3
  259. package/skills/testwriter/SKILL.md +49 -31
  260. package/scripts/demon.mjs +0 -251
  261. package/scripts/integration/file-attente.mjs +0 -61
  262. package/scripts/langages/cargo/touches.mjs +0 -93
  263. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -50,9 +50,8 @@ import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
50
50
  import { createRequire } from 'node:module';
51
51
  import path from 'node:path';
52
52
  import { CODE, paquets, TYPAGE } from '../../paquets.mjs';
53
- import { sources } from '../../services-du-noyau.mjs';
53
+ import { SCRIPT_DES_TESTS, sources } from '../../services-du-noyau.mjs';
54
54
  import { estUnTest } from './regle-des-tests.mjs';
55
- import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
56
55
 
57
56
  // The frame's package, as a project declares it, and its base configuration of Vitest.
58
57
  const PAQUET_DU_CADRE = '@roomi-fields/grillhouse';
@@ -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
  }
@@ -18,11 +18,21 @@
18
18
  // test is classed the day the rule arrives.
19
19
  // - large (`grand`): it mounts a trial repository (git's `init`, `clone` or `worktree add`) and
20
20
  // starts there something else than git (node, npm, a shell, a binary of the product);
21
+ // or it mounts a temporary directory (`mkdtemp`, `tmpdir`) and, in a process call carrying
22
+ // `cwd:` (or `-C`, `--prefix`), starts one of the heavy tools of OUTILS_LOURDS (turbo,
23
+ // vitest, knip, depcruise, api-extractor), named by a literal argument or a literal path to
24
+ // its binary, with no `git init` (grillhouse-44b.10.4, Bazel's test-encyclopedia: a test
25
+ // that runs the product in a trial project is large);
26
+ // or it starts a Temporal development server (the literal arguments `'server', 'start-dev'`
27
+ // in a process call of its text or of its test material): a test that mounts a real server
28
+ // is large (grillhouse-4nr.16). A tool named by a variable, or run by
29
+ // an npm script (`npm run verifier`), escapes the reading and the test stays medium; so
30
+ // does a call without `cwd` (on the repository);
21
31
  // - medium (`moyen`): it starts a process (it imports `child_process`, `execa` or `zx`), or it
22
32
  // imports several modules of the repository;
23
33
  // - small (`petit`): it imports one module of the repository at most, and starts no process.
24
34
  // - A large test of the day is a finding, `{ fichier, regle: 'grand-de-jour', message }`; a night
25
- // test or a time budget bench (HORS_DU_JOUR, ./vitest-config/cibles.mjs) is never one. A finding
35
+ // test or a time budget bench (`deNuitOuBanc`, ./vitest-config/cibles.mjs) is never one. A finding
26
36
  // inscribed in the project's debt (`grillhouse-dette.json`, ./dette.mjs) passes: the large tests
27
37
  // of the day that exist when the rule arrives are inscribed there by the update
28
38
  // (./migrations/0.25.0-tailles-des-tests.mjs), the count never rises, and a new one is refused.
@@ -33,7 +43,7 @@ import path from 'node:path';
33
43
  import { pathToFileURL } from 'node:url';
34
44
  import { trancher } from '../../dette.mjs';
35
45
  import { matieres } from './composants.mjs';
36
- import { HORS_DU_JOUR } from './vitest-config/cibles.mjs';
46
+ import { deNuitOuBanc } from './vitest-config/cibles.mjs';
37
47
  import {
38
48
  IMPORT,
39
49
  lireLeDisque,
@@ -56,13 +66,49 @@ const APPEL =
56
66
  /(?:(?<![\w$])(?:spawnSync|spawn|execFileSync|execFile|execSync|fork|execaSync|execa)|(?<![.\w$])exec)\s*\(\s*([^,)\n]*)/g;
57
67
  // A first argument that names git.
58
68
  const GIT = /^['"`]git(?:['"`]|\s)/;
69
+ /** The heavy tools of the product: a test that starts one in a trial project is large. */
70
+ export const OUTILS_LOURDS = ['turbo', 'vitest', 'knip', 'depcruise', 'api-extractor'];
71
+ // A Temporal development server started: the literal arguments `'server', 'start-dev'`.
72
+ const SERVEUR_TEMPORAL = /['"`]server['"`]\s*,\s*['"`]start-dev['"`]/;
73
+ // A temporary directory mounted.
74
+ const DOSSIER_TEMPORAIRE = /\bmkdtemp(?:Sync)?\b|\btmpdir\b/;
75
+ // An option of a call that carries the directory the process runs in.
76
+ const OPTION_DE_DOSSIER = /\bcwd\b|['"`](?:-C|--prefix)['"`]/;
77
+ // A heavy tool named by a literal in a call: a name, or the end of a path to its binary.
78
+ const OUTIL_LITTERAL = new RegExp(`(?:^|[\\s'"\`/])(?:${OUTILS_LOURDS.join('|')})(?=$|[\\s'"\`])`);
79
+ // The text of the call whose `(` is at <debut> in <texte>, to its closing parenthesis.
80
+ function appelComplet(texte, debut) {
81
+ let profondeur = 0;
82
+ const fin = Math.min(texte.length, debut + 2000);
83
+ for (let i = debut; i < fin; i++) {
84
+ if (texte[i] === '(') {
85
+ profondeur++;
86
+ } else if (texte[i] === ')' && --profondeur === 0) {
87
+ return texte.slice(debut, i + 1);
88
+ }
89
+ }
90
+ return texte.slice(debut, fin);
91
+ }
92
+ // Whether <texte> mounts a temporary directory and, in a process call carrying `cwd`, `-C` or
93
+ // `--prefix`, starts a heavy tool named by a literal.
94
+ function outilLourdEnProjetDEssai(texte) {
95
+ if (!DOSSIER_TEMPORAIRE.test(texte)) {
96
+ return false;
97
+ }
98
+ return [...texte.matchAll(APPEL)].some(m => {
99
+ const appel = appelComplet(texte, m.index + m[0].indexOf('('));
100
+ return OPTION_DE_DOSSIER.test(appel) && OUTIL_LITTERAL.test(appel);
101
+ });
102
+ }
59
103
  // A re-export of a whole module.
60
104
  const TOUT_REEXPORTE = /\bexport\s*\*\s*from\b/;
61
105
  // The names an import clause <clause> takes in braces (`import { a, b as c }` gives a and b);
62
106
  // null for a clause without braces (a namespace, a default), which takes the whole module.
63
107
  function nomsImportes(clause) {
64
108
  const b = /\{([^}]*)\}/.exec(clause);
65
- if (!b) return null;
109
+ if (!b) {
110
+ return null;
111
+ }
66
112
  return b[1]
67
113
  .split(',')
68
114
  .map(p =>
@@ -90,7 +136,7 @@ function entreeDeLaMatiere(paquet) {
90
136
  // The packages of the shared test material of the repository at <racine>: `[{ nom, dir, entree }]`,
91
137
  // `nom` the name by which a test imports it, `dir` its directory and `entree` the file of its
92
138
  // entry `./test-fixtures`, absolute.
93
- function lesMatieres(racine) {
139
+ export function lesMatieres(racine) {
94
140
  return matieres(racine).flatMap(({ dir, paquet }) => {
95
141
  let pkg;
96
142
  try {
@@ -121,12 +167,30 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
121
167
  const vus = new Set();
122
168
  // <f> followed; with <noms>, the names a test imports of it, its re-exports of a whole module
123
169
  // (`export * from`) are followed only to a module that declares one of them.
124
- const suivre = (f, noms = null) => {
125
- const cle = noms ? `${f}#${noms.join(',')}` : f;
126
- if (vus.has(f) || vus.has(cle)) return;
170
+ const lus = new Set();
171
+ let serveur = false;
172
+ const suivre = (f, noms = null, pris = noms) => {
173
+ const cle = noms || pris ? `${f}#${(noms ?? []).join(',')}#${(pris ?? []).join(',')}` : f;
174
+ if (vus.has(f) || vus.has(cle)) {
175
+ return;
176
+ }
127
177
  vus.add(cle);
128
178
  const texte = lire(f) ?? '';
129
- textes.push(texte);
179
+ if (!lus.has(f)) {
180
+ textes.push(texte);
181
+ }
182
+ lus.add(f);
183
+ // The server counts when the part of the file the test takes starts it: the whole file for
184
+ // the test itself or an import without braces, the exports it names otherwise.
185
+ const partie = pris
186
+ ? texte
187
+ .split(/(?=^export\s)/m)
188
+ .filter(c => pris.some(n => declare(c, n)))
189
+ .join('\n')
190
+ : texte;
191
+ if (SERVEUR_TEMPORAL.test(partie)) {
192
+ serveur = true;
193
+ }
130
194
  for (const m of texte.matchAll(IMPORT)) {
131
195
  const spec = m[1] ?? m[2] ?? m[3] ?? m[4];
132
196
  const parSonNom = lesMatieres.find(x => spec === `${x.nom}/test-fixtures`);
@@ -134,15 +198,22 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
134
198
  suivre(parSonNom.entree, nomsImportes(m[0]));
135
199
  continue;
136
200
  }
137
- if (!spec?.startsWith('.')) continue;
201
+ if (!spec?.startsWith('.')) {
202
+ continue;
203
+ }
138
204
  const cible = resoudre(f, spec, lire);
139
- if (!cible) continue;
205
+ if (!cible) {
206
+ continue;
207
+ }
140
208
  if (noms && TOUT_REEXPORTE.test(m[0]) && !noms.some(n => declare(lire(cible) ?? '', n))) {
141
209
  continue;
142
210
  }
143
211
  const rel = path.relative(racine, cible).split(path.sep).join('/');
144
- if ((MATIERE.test(rel) || dansUneMatiere(cible)) && !TEST.test(rel)) suivre(cible);
145
- else modules.add(cible);
212
+ if ((MATIERE.test(rel) || dansUneMatiere(cible)) && !TEST.test(rel)) {
213
+ suivre(cible, null, nomsImportes(m[0]));
214
+ } else {
215
+ modules.add(cible);
216
+ }
146
217
  }
147
218
  };
148
219
  suivre(fichier);
@@ -150,7 +221,8 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
150
221
  const processus = PROCESSUS.test(tout);
151
222
  const autreQueGit = [...tout.matchAll(APPEL)].some(m => !GIT.test(m[1].trim()));
152
223
  const taille =
153
- processus && autreQueGit && DEPOT_D_ESSAI.test(tout)
224
+ processus &&
225
+ ((autreQueGit && DEPOT_D_ESSAI.test(tout)) || outilLourdEnProjetDEssai(tout) || serveur)
154
226
  ? 'grand'
155
227
  : processus || modules.size > 1
156
228
  ? 'moyen'
@@ -158,9 +230,6 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
158
230
  return { taille, modules: [...modules] };
159
231
  }
160
232
 
161
- // Whether <r>, a path from the root, is a night test or a time budget bench.
162
- const horsDuJour = r => HORS_DU_JOUR.some(p => path.matchesGlob(r, p));
163
-
164
233
  // The directories a listing out of git leaves out.
165
234
  const HORS = /(?:^|\/)(?:node_modules|dist|\.git|\.turbo|\.claude)$/;
166
235
 
@@ -186,7 +255,7 @@ export function tailles(racine) {
186
255
  return testsDuDepot(racine).map(fichier => ({
187
256
  fichier,
188
257
  taille: classer(path.join(racine, fichier), lireLeDisque, racine, m).taille,
189
- nuit: horsDuJour(fichier),
258
+ nuit: deNuitOuBanc(fichier),
190
259
  }));
191
260
  }
192
261
 
@@ -200,7 +269,7 @@ export function verifier(racine) {
200
269
  .map(({ fichier }) => ({
201
270
  fichier,
202
271
  regle: GRAND_DE_JOUR,
203
- message: `${fichier} : un grand test (il monte un dépôt d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il se renomme en *.nuit.test.*, ou il se réduit à la plus petite taille qui prouve son critère.`,
272
+ message: `${fichier} : un grand test (il monte un dépôt ou un projet d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il se renomme en *.nuit.test.*, ou il se réduit à la plus petite taille qui prouve son critère.`,
204
273
  }));
205
274
  }
206
275
 
@@ -210,8 +279,12 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
210
279
  const compte = t => toutes.filter(x => x.taille === t).length;
211
280
  const nuit = toutes.filter(x => x.nuit).length;
212
281
  const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
213
- for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
214
- for (const l of lignes) process.stderr.write(`${l}\n`);
282
+ for (const r of refus) {
283
+ process.stderr.write(`⛔ ${r.message}\n`);
284
+ }
285
+ for (const l of lignes) {
286
+ process.stderr.write(`${l}\n`);
287
+ }
215
288
  process.stderr.write(
216
289
  `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${nuit} de nuit ou de banc.\n`
217
290
  );
@@ -26,21 +26,24 @@ import { readdirSync } from 'node:fs';
26
26
  import path from 'node:path';
27
27
  import { fileURLToPath, pathToFileURL } from 'node:url';
28
28
  import { A_REPASSER, attendreDeLaPlace } from '../../services-du-noyau.mjs';
29
- import { fichiersTemoins, NUIT_VARIABLE } from './vitest-config/cibles.mjs';
29
+ import {
30
+ estUnBanc,
31
+ estUnTestDeNuit,
32
+ fichiersTemoins,
33
+ NUIT_VARIABLE,
34
+ } from './vitest-config/cibles.mjs';
30
35
 
31
36
  const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.mjs', import.meta.url));
32
37
  const HORS = new Set(['node_modules', 'dist', '.git']);
33
- const DE_NUIT = /\.nuit\.(test|spec)\.(c|m)?[jt]sx?$/;
34
- const BANC = /\.budget\.(test|spec)\.(c|m)?[jt]sx?$/;
35
38
 
36
- // Whether a file whose name <motif> matches lies under <dossier>.
37
- function enTient(dossier, motif) {
39
+ // Whether a file that <est> (the rules of ./vitest-config/cibles.mjs) lies under <dossier>.
40
+ function enTient(dossier, est) {
38
41
  for (const e of readdirSync(dossier, { withFileTypes: true })) {
39
42
  if (e.isDirectory()) {
40
- if (!HORS.has(e.name) && enTient(path.join(dossier, e.name), motif)) {
43
+ if (!HORS.has(e.name) && enTient(path.join(dossier, e.name), est)) {
41
44
  return true;
42
45
  }
43
- } else if (e.isFile() && motif.test(e.name)) {
46
+ } else if (e.isFile() && est(e.name)) {
44
47
  return true;
45
48
  }
46
49
  }
@@ -54,8 +57,8 @@ function enTient(dossier, motif) {
54
57
  */
55
58
  export function testsDeNuit(racine) {
56
59
  const runs = [
57
- enTient(racine, DE_NUIT) && 'nuit',
58
- (enTient(racine, BANC) || fichiersTemoins(racine).length > 0) && 'mesures',
60
+ enTient(racine, estUnTestDeNuit) && 'nuit',
61
+ (enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0) && 'mesures',
59
62
  ].filter(Boolean);
60
63
  if (runs.length === 0) {
61
64
  return 0;
@@ -63,7 +66,9 @@ export function testsDeNuit(racine) {
63
66
  try {
64
67
  attendreDeLaPlace();
65
68
  } catch (e) {
66
- if (e?.name !== 'AttenteDeLaMachine') throw e;
69
+ if (e?.name !== 'AttenteDeLaMachine') {
70
+ throw e;
71
+ }
67
72
  process.stdout.write(`${e.message}\n`);
68
73
  return e.code;
69
74
  }
@@ -89,13 +89,16 @@ import {
89
89
  ouvrirBase,
90
90
  paquetsDeLEnveloppe,
91
91
  retirerALInterruption,
92
+ SCRIPT_DES_TESTS,
93
+ surUnePlace,
94
+ TESTS_CIBLES,
95
+ testsCibles,
96
+ tracesDuPlan,
92
97
  } from '../../services-du-noyau.mjs';
93
98
  import { paquets } from '../../paquets.mjs';
94
99
  import { garderLesResumes } from './verdict.mjs';
95
100
  import { RESULTATS } from '../../resultats.mjs';
96
- import { planifier, tracesDuPlan } from './turbo-des-paquets.mjs';
97
- import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
98
- import { VARIABLE } from './vitest-config/cibles.mjs';
101
+ import { horsTypescript, planifier } from './turbo-des-paquets.mjs';
99
102
 
100
103
  const racine = process.cwd();
101
104
  // The base of the run (scripts/mesure/base-de-passe.mjs): this process and every run of
@@ -111,17 +114,21 @@ const options = args.filter(a => a.startsWith('-') && a !== '--force');
111
114
  const chemins = args.filter(a => !a.startsWith('-'));
112
115
  // Under the circuit's mark, the tests measured against the last green; `--force` plays them all.
113
116
  const depuis = process.env[DEPUIS_LE_VERT] ? mesure(racine, { tout: force }) : null;
114
- if (depuis) process.stdout.write(`${depuis.ligne}\n`);
117
+ if (depuis) {
118
+ process.stdout.write(`${depuis.ligne}\n`);
119
+ }
115
120
 
116
121
  // One Turborepo run of <args>, VARIABLE set to <tests> (unset without), each task whose
117
122
  // dependencies succeed played to its end; its exit code. While the run names a results directory
118
123
  // (RESULTATS), Turborepo writes its summary, which goes there.
119
124
  const turbo = (args, tests) => {
120
125
  const env = { ...process.env };
121
- delete env[VARIABLE];
126
+ delete env[TESTS_CIBLES];
122
127
  delete env[CHANGEMENTS];
123
128
  Object.assign(env, depuis?.env ?? {});
124
- if (tests) env[VARIABLE] = JSON.stringify(tests);
129
+ if (tests) {
130
+ env[TESTS_CIBLES] = JSON.stringify(tests);
131
+ }
125
132
  const resume = env[RESULTATS] ? ['--summarize'] : [];
126
133
  const runs = path.join(racine, '.turbo', 'runs');
127
134
  const avant = new Set(existsSync(runs) ? readdirSync(runs) : []);
@@ -139,7 +146,9 @@ const turbo = (args, tests) => {
139
146
  stdio: 'inherit',
140
147
  env,
141
148
  }).status ?? 1;
142
- if (resume.length) garderLesResumes(racine, avant, env);
149
+ if (resume.length) {
150
+ garderLesResumes(racine, avant, env);
151
+ }
143
152
  return code;
144
153
  };
145
154
 
@@ -162,17 +171,24 @@ const traces = (filtres, noms) => {
162
171
  // in an envelope, the build of the packages they name with their own traces, then the tests alone.
163
172
  // Its exit code: the first that is not 0, else the tests'.
164
173
  const cibles = (filtres, passes) => {
165
- const tests = { arguments: passes, ...(force ? { rejouer: new Date().toISOString() } : {}) };
166
- if (!enveloppe) return turbo([SCRIPT_DES_TESTS, ...filtres], tests);
174
+ // `testsCibles` is undefined with no path and no `--force`: the variable then stays unset.
175
+ const tests = testsCibles({ arguments: passes, force });
176
+ if (!enveloppe) {
177
+ return turbo([SCRIPT_DES_TESTS, ...filtres], tests);
178
+ }
167
179
  // A package the envelope shows read-only arrives built: only the packages it shows in writing
168
180
  // build, as the envelope mounts them (`inscriptible`).
169
181
  const construits = filtres.filter(f => inscriptible(dossiers.get(f.slice('--filter='.length))));
170
182
  if (filtres.length === 0 || construits.length > 0) {
171
183
  const noms = new Set(construits.map(f => f.slice('--filter='.length)));
172
184
  const propres = construits.length ? traces(construits, noms) : { ids: [] };
173
- if (propres.code !== undefined) return propres.code;
185
+ if (propres.code !== undefined) {
186
+ return propres.code;
187
+ }
174
188
  const construction = turbo(['build', ...propres.ids, '--only', ...construits]);
175
- if (construction !== 0) return construction;
189
+ if (construction !== 0) {
190
+ return construction;
191
+ }
176
192
  }
177
193
  return turbo([SCRIPT_DES_TESTS, '--only', ...filtres], tests);
178
194
  };
@@ -195,11 +211,13 @@ const dossiers = new Map(liste.map(p => [p.pkg.name, path.join(racine, p.dossier
195
211
  const lancer = () => {
196
212
  if (chemins.length === 0) {
197
213
  return turbo(
198
- [SCRIPT_DES_TESTS, ...(force ? ['--force'] : [])],
214
+ [SCRIPT_DES_TESTS, ...horsTypescript(racine), ...(force ? ['--force'] : [])],
199
215
  options.length ? { arguments: options } : undefined
200
216
  );
201
217
  }
202
- if (liste.length === 0) return cibles([], [...chemins, ...options]);
218
+ if (liste.length === 0) {
219
+ return cibles([], [...chemins, ...options]);
220
+ }
203
221
 
204
222
  // The package of the frame that holds each path, the paths made absolute; the refusals.
205
223
  const refus = [];
@@ -229,7 +247,9 @@ const lancer = () => {
229
247
  }
230
248
  }
231
249
  if (refus.length) {
232
- for (const l of refus) process.stderr.write(`${l}\n`);
250
+ for (const l of refus) {
251
+ process.stderr.write(`${l}\n`);
252
+ }
233
253
  return 2;
234
254
  }
235
255
  return cibles(
@@ -239,7 +259,12 @@ const lancer = () => {
239
259
  };
240
260
 
241
261
  try {
242
- process.exitCode = lancer();
262
+ // The run takes a place of the machine (scripts/places-de-la-machine.mjs), whose mark every run
263
+ // of Turborepo carries to its tasks.
264
+ process.exitCode = surUnePlace(env => {
265
+ Object.assign(process.env, env);
266
+ return lancer();
267
+ });
243
268
  } finally {
244
269
  lacher();
245
270
  depuis?.retirer();