@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
@@ -4,6 +4,7 @@
4
4
  // `commandes`; run by `grillhouse <commande>` in the root of the workspace, its arguments after.
5
5
  //
6
6
  // npx grillhouse tests [--force] [<chemin>…] [--<option>…] tester
7
+ // npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
7
8
  // npx grillhouse verifier [--tout | --gardes] verifier
8
9
  // node commandes.mjs typer typer
9
10
  // npx grillhouse preparer preparer
@@ -14,47 +15,66 @@
14
15
  // - Each guard of structure of the module (./tailles-des-tests.mjs, ./clippy.mjs,
15
16
  // ./frontieres.mjs, ./index-interfaces.mjs) is a command by its name too, its own script, as the module typescript's: the line of a red
16
17
  // guard (`grillhouse <garde>`, scripts/gardes-du-cadre.mjs) names a command that exists.
17
- // - `tester` plays the tests of each crate chosen, one crate after the other. For a crate that
18
- // plays tests (./composants.mjs, `joueDesTests`): the build of its test targets, `cargo test
19
- // --no-run -p <crate>`, a task `build` of its own, as Turborepo's `test` depends on `build`
20
- // (grillhouse-egm); then `cargo nextest run -p <crate> --no-fail-fast`, which finds them built.
21
- // Then `cargo test --doc -p <crate>` for a crate whose library has doctests, which nextest does
22
- // not play. A failed build leaves the crate's other tasks not played (`code` null): a test that
23
- // does not compile is a red of the build, which the proof of the red reads as one (« construction
24
- // de <crate> », scripts/circuit.mjs), and the tests play at the checks. The output of the build
25
- // goes to its log, `<target>/grillhouse/<crate>-build.log`, the task's `journal` from the root,
26
- // then to the error stream. A path, written from the root, chooses the crate that holds it; the
27
- // source of a test target (`<crate>/tests/<nom>.rs`) builds and plays that target alone
28
- // (`--test <nom>`), without the doctests. A path out of every crate, or in a crate without tests, is refused, named, and
29
- // nothing plays (code 2). Without a path, every crate plays, or, under the circuit's mark
30
- // (`GRILLHOUSE_DEPUIS_LE_VERT`), the crates the changes since the last green touch and their
31
- // dependents (./touches.mjs), every crate when no last green counts. `--force` changes nothing:
32
- // cargo keeps no result of a test to replay. Another option goes to nextest.
18
+ // - `tester` plays the tests of the crates as tasks of Turborepo, the way of the module
19
+ // typescript's (scripts/langages/typescript/tests.mjs): `turbo run test:unit --filter=<crate>…`
20
+ // on the crates of the graph, each one a package with its own `package.json`
21
+ // (scripts/paquet-npm.mjs), the task of a crate whose inputs did not move replayed from
22
+ // Turborepo's cache; the frame selects nothing by the last green. A path, written from the root,
23
+ // chooses the crate that holds it (only its task plays) and reaches the task, made absolute, in
24
+ // the variable `GRILLHOUSE_TESTS` (`TESTS_CIBLES`, scripts/taches-du-graphe.mjs) beside the
25
+ // options, which the `env` of the task names: it enters its hash, so a run by path of a crate
26
+ // unchanged replays from the cache, and another path moves the hash. `--force` carries the moment
27
+ // of the run in the variable instead (`rejouer`), which no cached run holds: the task plays for
28
+ // real (`npm run test:forcer`). A path out of every crate, or in a crate without tests, or in a
29
+ // crate that is no package of the graph, is refused, named, and nothing plays (code 2). The exit
30
+ // code is Turborepo's.
31
+ // - `tests-du-paquet <chemin>…` is the body of that task, which the `test:unit` script of a crate
32
+ // calls (`grillhouse tests-du-paquet <dossier du crate>`, written with the package): it never runs
33
+ // Turborepo, so `tester` and the task do not loop. For a crate that plays tests
34
+ // (./composants.mjs, `joueDesTests`): the build of its test targets, `cargo test --no-run -p
35
+ // <crate>`, a task `build` of its own, as Turborepo's `test` depends on `build` (grillhouse-egm);
36
+ // then `cargo nextest run -p <crate> --no-fail-fast`, which finds them built. Then `cargo test
37
+ // --doc -p <crate>` for a crate whose library has doctests, which nextest does not play. A failed
38
+ // build leaves the crate's other tasks not played (`code` null): a test that does not compile is
39
+ // a red of the build, which the proof of the red reads as one (« construction de <crate> »,
40
+ // scripts/circuit.mjs), and the tests play at the checks. The output of the build goes to its log,
41
+ // `<target>/grillhouse/<crate>-build.log`, the task's `journal` from the root, then to the error
42
+ // stream. The folder of a crate plays it whole; the source of a test target
43
+ // (`<crate>/tests/<nom>.rs`) builds and plays that target alone (`--test <nom>`), without the
44
+ // doctests; the paths of the variable `GRILLHOUSE_TESTS` that lie in the crate replace the folder.
45
+ // A path out of every crate, or in a crate without tests, is refused, named, and nothing plays
46
+ // (code 2). `--force` changes nothing here: cargo keeps no result of a test to replay. Another
47
+ // option goes to nextest.
33
48
  // - A test target is named by its file, as `*_nuit_test.py` and `*.budget.test.*` (grillhouse-wbk):
34
49
  // `tests/<nom>_nuit.rs` (or `tests/<nom>_nuit/main.rs`, the target `<nom>_nuit`) is a night
35
50
  // test, `tests/<nom>_budget.rs` a time budget bench. A crate played whole leaves both out of
36
51
  // nextest, in `tester` as in `verifier`, which then plays its library (`--lib`), its binaries
37
52
  // (`--bins`) and each other test target (`--test <nom>`); its build still compiles them. The
38
53
  // night plays them (`tests-de-nuit`), as the module typescript's `*.budget.test.*`. A path that
39
- // names the file of one plays it, as Bazel builds a target tagged `manual` when named; a folder
40
- // named leaves them out, as the day does.
54
+ // names the file of a bench plays it, as Bazel builds a target tagged `manual` when named; a path
55
+ // that names a night test is refused, named, and nothing plays (code 2): the night alone plays
56
+ // it; a folder named leaves them out, as the day does.
41
57
  // - A time budget bench plays alone, one test at a time (`--test-threads 1`), in a task `budget` of
42
58
  // its own after the other tests: in `tests-de-nuit` and in a path that names it. A red of the
43
59
  // task while the CPU pressure of the machine (`lirePression` of ./jointure) is at or above its
44
60
  // threshold at its start or at its end is « à repasser », 75, said in one line with the
45
61
  // pressure; at rest, a red.
46
- // - `verifier` plays the tests of the crates the changes since the last green touch and of their
47
- // dependents (every crate with `--tout`, or when no last green counts), as Turborepo's
48
- // `--filter=...[<commit>]`, then `cargo deny check`; green, it keeps the last green
49
- // (scripts/dernier-vert.mjs). It plays under the lock of the machine, one heavy measure at a
50
- // time (`avecLaMachine` of ./jointure, as the module typescript's verifier): a measure that
51
- // holds it makes it wait, and the bound of the wait reached, it stops at 75 without running
52
- // cargo.
62
+ // - `verifier` plays the tests of the crates as the tasks of Turborepo (`turbo run test:unit
63
+ // --filter=<crate>…`, each crate a package of the graph, the cache of the tasks selecting those
64
+ // that play again; `--tout` plays them for real, the moment of the pass in the variable
65
+ // `GRILLHOUSE_TESTS`), then `cargo deny check`, the only run of cargo of the pass. It keeps no
66
+ // green: the one pass of the verification keeps it (scripts/dernier-vert.mjs,
67
+ // scripts/langages/typescript/verifier.mjs). Beside the module of package.json, whose pass plays
68
+ // every task of the graph, the composed command sets `GRAPHE_JOUE` and `verifier` plays `cargo
69
+ // deny check` alone (scripts/commandes-composees.mjs). It plays on a place of the machine and under its lock,
70
+ // one heavy measure at a time (`avecLaMachineEtUnePlace` of ./jointure, as the module typescript's verifier): a
71
+ // measure that holds it makes it wait, and the bound of the wait reached, it stops at 75 without
72
+ // running cargo.
53
73
  // - `verifier --gardes` plays the guards alone, the same verdict as the module typescript's: the
54
74
  // project's root scripts `grillhouse:gardes` (the frame's guards) then `gardes` (its own), each
55
75
  // one the package.json holds a task of the root, by npm, without its tests nor cargo deny, and
56
76
  // keeps no last green.
57
- // - `tester`, `verifier` and `tests-de-nuit` play under a temporary directory of their pass, the module's guard of
77
+ // - `tests-du-paquet`, `verifier` and `tests-de-nuit` play under a temporary directory of their pass, the module's guard of
58
78
  // the temporary directory, as the CI of osc-bridge (OB-ud1.3): a base (`ouvrirBase` of
59
79
  // ./jointure, genre `tests` or `verification`) in the temporary directory of the environment,
60
80
  // named in TMPDIR, TMP and TEMP to cargo, which nextest and the doctests inherit; removed at the
@@ -68,8 +88,8 @@
68
88
  // - `typer`: `cargo check --all-targets`. `preparer`: `cargo fetch --locked`.
69
89
  // - Cargo runs with rustc wrapped by sccache, its cache common to the copies of the machine
70
90
  // (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr), its server started
71
- // under the machine's /tmp before each run of cargo that compiles (grillhouse-qmk). `tester`, `verifier`
72
- // and `typer` refuse, before any run of cargo, a PATH without sccache, in one line that names it
91
+ // under the machine's /tmp before each run of cargo that compiles (grillhouse-qmk).
92
+ // `tests-du-paquet`, `verifier` and `typer` refuse, before any run of cargo, a PATH without sccache, in one line that names it
73
93
  // and `npx grillhouse maj`, which installs it (code 2).
74
94
  // - Nextest reads the frame's profile `grillhouse` (./nextest.toml, a tool's configuration under
75
95
  // the project's own, `--tool-config-file`), whose JUnit report lands in nextest's store, at
@@ -79,7 +99,7 @@
79
99
  // there what ./verdict.mjs reads: its tasks, each planned before it plays (`code` null until it
80
100
  // ran), and the JUnit report of each run of nextest. A task of the workspace is named after its
81
101
  // root, `//`, as Turborepo names the root's tasks.
82
- // - `tester`, `verifier` and `preparer` refuse, before any run of cargo, a workspace whose
102
+ // - `tests-du-paquet`, `verifier` and `preparer` refuse, before any run of cargo, a workspace whose
83
103
  // Cargo.lock git does not track (grillhouse-rph), in one line that names the file and the
84
104
  // gesture: `git add Cargo.lock`, or `cargo generate-lockfile` first when it is absent. Cargo
85
105
  // recommends committing it for every project, and the verification plays the exact versions of
@@ -88,6 +108,10 @@
88
108
  // git, the integration's.
89
109
  // - The exit code: 0 when every task is green, 75 when the only reds are « à repasser », 1
90
110
  // otherwise; 2 for a path refused, a Cargo.lock not tracked or a command unknown.
111
+ // - `construire --echec <fichier> <plan>` is the launcher's build of the copy (scripts/enveloppe/lancer.sh),
112
+ // the core's one for every language (`construireDepuisLesArguments` of
113
+ // scripts/taches-du-graphe.mjs): the plan and its providers by `turbo run build --filter=<paquet>…`.
114
+ // `construire <chemin>` builds one crate (`cargo build -p`), as the script `build` of its package.
91
115
  import { spawnSync } from 'node:child_process';
92
116
  import {
93
117
  closeSync,
@@ -95,6 +119,7 @@ import {
95
119
  existsSync,
96
120
  mkdirSync,
97
121
  openSync,
122
+ readdirSync,
98
123
  readFileSync,
99
124
  rmSync,
100
125
  writeFileSync,
@@ -105,36 +130,58 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
105
130
  import { RESULTATS } from '../../resultats.mjs';
106
131
  import {
107
132
  AttenteDeLaMachine,
108
- avecLaMachine,
109
- CHANGEMENTS,
110
- DEPUIS_LE_VERT,
133
+ surUnePlace,
134
+ avecLaMachineEtUnePlace,
135
+ cheminsDeLaTache,
136
+ construireDepuisLesArguments,
111
137
  ecrirePression,
112
- garderLeVert,
138
+ GRAPHE_JOUE,
139
+ lancerLesTaches,
113
140
  ligneDesRestes,
114
141
  lirePression,
115
- mesure,
142
+ nomDuPaquet,
116
143
  ouvrirBase,
117
144
  retirerALInterruption,
145
+ SCRIPT_DES_TESTS,
118
146
  SEUIL_PRESSION,
147
+ testsCibles,
148
+ travailleursDeLaSeance,
119
149
  } from '../../services-du-noyau.mjs';
120
- import { BANC, composantDans, crates, DE_NUIT, joueDesTests, metadonnees } from './composants.mjs';
150
+ import {
151
+ BANC,
152
+ COPIE_DE_L_ARBRE,
153
+ composantDans,
154
+ crates,
155
+ DE_NUIT,
156
+ joueDesTests,
157
+ metadonnees,
158
+ } from './composants.mjs';
121
159
  import { avecSccache, demarrerLeServeur, sccacheAbsent } from './sccache.mjs';
122
- import { touchesDesFichiers } from './touches.mjs';
123
160
  import { JUNIT, TACHES } from './verdict.mjs';
124
161
 
125
162
  const ICI = fileURLToPath(import.meta.url);
126
163
  const NEXTEST = path.join(path.dirname(ICI), 'nextest.toml');
127
164
  const PROFIL = 'grillhouse';
128
- export const NOMS = ['tester', 'verifier', 'typer', 'preparer', 'tests-de-nuit'];
165
+ export const NOMS = [
166
+ 'tester',
167
+ 'tests-du-paquet',
168
+ 'verifier',
169
+ 'typer',
170
+ 'construire',
171
+ 'preparer',
172
+ 'tests-de-nuit',
173
+ ];
174
+ // The task runner of the graph of the packages.
175
+ const OUTIL = 'turbo';
129
176
  const A_REPASSER = 75;
130
177
  const RACINE = '//';
131
178
  // The task of the time budget benches of a crate.
132
179
  const BUDGET = 'budget';
133
180
  const VERROU = 'Cargo.lock';
134
181
  // The commands that play the exact versions of the repository, refused without its Cargo.lock.
135
- const VERROUILLEES = ['tester', 'verifier', 'preparer', 'tests-de-nuit'];
182
+ const VERROUILLEES = ['tests-du-paquet', 'verifier', 'preparer', 'tests-de-nuit'];
136
183
  // The commands that compile, refused without sccache on the PATH (./sccache.mjs).
137
- const COMPILENT = ['tester', 'verifier', 'typer', 'tests-de-nuit'];
184
+ const COMPILENT = ['tests-du-paquet', 'verifier', 'typer', 'construire', 'tests-de-nuit'];
138
185
  // The kinds of a target that are no library.
139
186
  const PAS_UNE_BIBLIOTHEQUE = ['test', 'bin', 'example', 'bench', 'custom-build'];
140
187
 
@@ -151,8 +198,21 @@ export function horsDuJour(t) {
151
198
  }
152
199
  return t.name.endsWith(BANC) ? 'banc' : null;
153
200
  }
201
+
202
+ /**
203
+ * Whether the test file <chemin> (from the root <racine>) is a test target out of the day, a night
204
+ * test or a time budget bench (`horsDuJour`); false for any other file, a unit test of `src/`
205
+ * included.
206
+ * @param {string} chemin
207
+ * @param {string} racine
208
+ */
209
+ export function fichierHorsDuJour(chemin, racine) {
210
+ const abs = path.resolve(racine, chemin);
211
+ const c = crates(racine).find(x => x.cibles.some(t => t.src === abs));
212
+ return Boolean(c?.cibles.some(t => t.src === abs && horsDuJour(t) !== null));
213
+ }
154
214
  // The subcommands of cargo that compile, before which the server of sccache starts.
155
- const COMPILATIONS = ['test', 'nextest', 'check'];
215
+ const COMPILATIONS = ['test', 'nextest', 'check', 'build'];
156
216
 
157
217
  /** The guards of structure of the module, in the order they play: each its name, its script beside
158
218
  * this one, and its arguments as a guard. */
@@ -226,7 +286,10 @@ function passe(racine, env) {
226
286
  ecrire();
227
287
  return { t, args };
228
288
  },
229
- jouer({ t, args }, { junit = null, journal = null, programme = 'cargo' } = {}) {
289
+ jouer(
290
+ { t, args },
291
+ { junit = null, journal = null, programme = 'cargo', temporaire = {} } = {}
292
+ ) {
230
293
  // A report of an earlier run is no report of this one, which may write none.
231
294
  if (junit) {
232
295
  rmSync(junit, { force: true });
@@ -246,7 +309,7 @@ function passe(racine, env) {
246
309
  try {
247
310
  r = spawnSync(programme, args, {
248
311
  cwd: racine,
249
- env: compilation,
312
+ env: { ...compilation, ...temporaire },
250
313
  stdio: ['inherit', fd, fd],
251
314
  });
252
315
  } finally {
@@ -255,7 +318,11 @@ function passe(racine, env) {
255
318
  process.stderr.write(readFileSync(journal, 'utf8'));
256
319
  t.journal = path.relative(racine, journal);
257
320
  } else {
258
- 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
+ });
259
326
  }
260
327
  t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
261
328
  if (junit && dossier && existsSync(junit)) {
@@ -269,6 +336,15 @@ function passe(racine, env) {
269
336
  ecrire();
270
337
  return t.code;
271
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
+ },
272
348
  code() {
273
349
  const rouges = taches.filter(t => t.code !== 0);
274
350
  if (rouges.length === 0) {
@@ -298,37 +374,34 @@ function sousCharge(t, pressions) {
298
374
  t.code = A_REPASSER;
299
375
  }
300
376
 
301
- // The crates the changes since the last green of <racine> touch, and their dependents; every crate
302
- // with <tout> or without a last green that counts. `{ choix, m }`, `m` the measure.
303
- function depuisLeVert(racine, tous, tout, env) {
304
- const m = mesure(racine, { tout, dans: env.TMPDIR });
305
- process.stderr.write(`${m.ligne}\n`);
306
- const f = m.env[CHANGEMENTS];
307
- if (!f) {
308
- return { choix: tous, m };
309
- }
310
- const ch = JSON.parse(readFileSync(f, 'utf8'));
311
- const t = touchesDesFichiers(racine, [...ch.fichiers, ...ch.supprimes]);
312
- const nommes = new Set([...t.touches, ...t.dependants].map(c => c.dossier));
313
- return { choix: tous.filter(c => nommes.has(c.composant.dossier)), m };
314
- }
315
-
316
377
  // Plans and plays the tests of the crates <choix> in the run <p>, each `{ c, cibles }`: `cibles`
317
378
  // the test targets named, empty for the whole crate of the day (its night tests and its benches
318
379
  // left out). For a crate that plays tests:
319
380
  // the build of its test targets first, then nextest, then its doctests; a failed build leaves the
320
381
  // crate's other tasks not played. The benches named, each crate's in a task `budget`, are
321
382
  // planned with the rest and played by the function this one returns, after the other tests.
322
- function jouerLesTests(racine, p, choix, options) {
383
+ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
323
384
  const m = metadonnees(racine);
324
385
  // Nextest's store is `target/nextest` under the workspace's root (its default `store.dir`),
325
386
  // whatever the target directory of the compilations (./sccache.mjs).
326
387
  const junit = path.join(m.workspace_root, 'target', 'nextest', PROFIL, 'junit.xml');
327
388
  const nextest = ['nextest', 'run', '--tool-config-file', `${PROFIL}:${NEXTEST}`];
328
389
  nextest.push('--profile', PROFIL, '--no-fail-fast');
390
+ // The workers of a session of an agent (GRILLHOUSE_TRAVAILLEURS): `-j` of cargo and of nextest;
391
+ // a heavy pass, without it, keeps every core.
392
+ const travailleurs = travailleursDeLaSeance(process.env);
393
+ const j = travailleurs === null ? [] : ['-j', String(travailleurs)];
394
+ // A bench plays on one thread (`--test-threads 1`, which `-j` of nextest is the alias of): it
395
+ // takes the arguments without `-j`.
396
+ const nextestDuBanc = [...nextest];
397
+ nextest.push(...j);
329
398
  const parCrate = [];
330
399
  const bancs = [];
331
- for (const { c, cibles } of choix) {
400
+ for (const { c, cibles: nommees, jour } of choix) {
401
+ // Targets named beside the day of the crate (`jour`, a unit test of `src/` named): the day
402
+ // builds whole, and plays besides the targets named.
403
+ const cibles = jour && nommees.length === 0 ? [] : nommees;
404
+ const avecLeJour = Boolean(jour) && nommees.length > 0;
332
405
  Object.assign(p.cibles, binaires(c));
333
406
  const d = c.composant.dossier;
334
407
  const nom = c.composant.nom;
@@ -340,26 +413,54 @@ function jouerLesTests(racine, p, choix, options) {
340
413
  const desBancs = cibles.filter(deBanc);
341
414
  const autres = cibles.filter(n => !deBanc(n));
342
415
  const journal = path.join(m.target_directory, 'grillhouse', `${nom}-build.log`);
343
- const construction = ['test', '--no-run', '-p', nom, ...cibles.flatMap(n => ['--test', n])];
416
+ const construction = [
417
+ 'test',
418
+ '--no-run',
419
+ ...j,
420
+ '-p',
421
+ nom,
422
+ ...(avecLeJour ? [] : cibles.flatMap(n => ['--test', n])),
423
+ ];
344
424
  prevues.push([p.prevoir(nom, d, 'build', false, construction), { journal }]);
345
- if (cibles.length === 0 || autres.length) {
346
- const selection = cibles.length ? autres.flatMap(n => ['--test', n]) : duJour(c);
425
+ if (cibles.length === 0 || autres.length || avecLeJour) {
426
+ const duC = duJour(c);
427
+ const nommes = autres.flatMap(n => ['--test', n]);
428
+ const selection = !cibles.length
429
+ ? duC
430
+ : avecLeJour
431
+ ? duC.length
432
+ ? [...duC, ...nommes]
433
+ : []
434
+ : nommes;
347
435
  const args = [...nextest, '-p', nom, ...selection, ...options];
348
- 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
+ ]);
349
440
  }
350
441
  if (desBancs.length) {
351
- const args = [...nextest, '-p', nom, ...desBancs.flatMap(n => ['--test', n])];
352
- bancs.push({ nom, d, args: [...args, '--test-threads', '1', ...options], etat });
442
+ const args = [...nextestDuBanc, '-p', nom, ...desBancs.flatMap(n => ['--test', n])];
443
+ bancs.push({
444
+ nom,
445
+ d,
446
+ temporaire: temporaire(nom),
447
+ args: [...args, '--test-threads', '1', ...options],
448
+ etat,
449
+ });
353
450
  }
354
451
  }
355
452
  const doctests = c.cibles.some(t => t.kind.includes('lib') && t.doctest !== false);
356
- if (cibles.length === 0 && doctests) {
357
- const args = ['test', '--doc', '-p', nom];
358
- prevues.push([p.prevoir(nom, d, 'doctest', true, args), {}]);
453
+ if ((cibles.length === 0 || avecLeJour) && doctests) {
454
+ const args = ['test', '--doc', ...j, '-p', nom];
455
+ prevues.push([p.prevoir(nom, d, 'doctest', true, args), { temporaire: temporaire(nom) }]);
359
456
  }
360
457
  parCrate.push([prevues, etat]);
361
458
  }
362
- 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
+ ]);
363
464
  for (const [prevues, etat] of parCrate) {
364
465
  for (const [t, o] of prevues) {
365
466
  if (p.jouer(t, o) !== 0 && t.t.script === 'build') {
@@ -369,9 +470,9 @@ function jouerLesTests(racine, p, choix, options) {
369
470
  }
370
471
  }
371
472
  return () => {
372
- for (const [t, etat] of prevusBancs) {
473
+ for (const [t, etat, temporaire] of prevusBancs) {
373
474
  if (etat.construit) {
374
- p.jouer(t, { junit });
475
+ p.jouer(t, { junit, temporaire });
375
476
  }
376
477
  }
377
478
  };
@@ -393,6 +494,9 @@ function duJour(c) {
393
494
  ];
394
495
  }
395
496
 
497
+ // The refusal of a night test named in a targeted run: the night alone plays it.
498
+ const REFUS_DE_NUIT = 'un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)';
499
+
396
500
  // The crates the paths <chemins> choose in <racine>: `{ choix }`, or `{ refus }` naming each path
397
501
  // refused.
398
502
  function choisir(racine, tous, chemins) {
@@ -410,18 +514,27 @@ function choisir(racine, tous, chemins) {
410
514
  refus.push(`${chemin} : hors de tout crate`);
411
515
  continue;
412
516
  }
413
- if (!joueDesTests(racine, c)) {
517
+ // The folder of a crate without tests plays whole (its doctests, as the task of its package
518
+ // does); any other path in it names a test that does not exist.
519
+ if (!joueDesTests(racine, c) && abs !== c.dossier) {
414
520
  refus.push(`${chemin} : ${c.nom} n'a aucun test, ni dossier tests/, ni tests.rs sous src/`);
415
521
  continue;
416
522
  }
417
523
  const cible = crate.cibles.find(t => t.kind.includes('test') && t.src === abs);
524
+ // A night test plays at night alone (`tests-de-nuit`): a targeted run refuses it, named.
525
+ if (cible && horsDuJour(cible) === 'nuit') {
526
+ refus.push(`${chemin} : ${REFUS_DE_NUIT}`);
527
+ continue;
528
+ }
418
529
  const deja = parDossier.get(c.dossier);
530
+ // A file with no target of its own (a unit test of `src/`) asks for the day of its crate; a
531
+ // target named stays named, whatever the order of the paths.
532
+ const entree = deja ?? { c: crate, cibles: [], jour: false };
533
+ parDossier.set(c.dossier, entree);
419
534
  if (!cible) {
420
- parDossier.set(c.dossier, { c: crate, cibles: [] });
421
- } else if (!deja) {
422
- parDossier.set(c.dossier, { c: crate, cibles: [cible.name] });
423
- } else if (deja.cibles.length) {
424
- deja.cibles.push(cible.name);
535
+ entree.jour = true;
536
+ } else {
537
+ entree.cibles.push(cible.name);
425
538
  }
426
539
  }
427
540
  if (refus.length) {
@@ -434,32 +547,57 @@ function choisir(racine, tous, chemins) {
434
547
  };
435
548
  }
436
549
 
550
+ // The packages of the graph of the crates <crates>: `{ noms, absents }`, the names of those that are
551
+ // packages of the graph, and the names of the crates that are not.
552
+ function nomsDuGraphe(racine, crates) {
553
+ const noms = new Set();
554
+ const absents = [];
555
+ for (const c of crates) {
556
+ const nom = nomDuPaquet(racine, c.composant.dossier);
557
+ if (nom === null) {
558
+ absents.push(c.composant.nom);
559
+ } else {
560
+ noms.add(nom);
561
+ }
562
+ }
563
+ return { noms, absents };
564
+ }
565
+
566
+ // Says, on the error stream, each crate of <absents> that is no package of the graph: its tests do
567
+ // not play, as a package without a `package.json` is out of Turborepo's tasks.
568
+ function direLesAbsents(absents) {
569
+ for (const nom of absents) {
570
+ process.stderr.write(
571
+ `⚠️ ${nom} : pas un paquet du graphe (package.json absent) ; ses tests ne se jouent pas : npx grillhouse maj\n`
572
+ );
573
+ }
574
+ }
575
+
437
576
  // The pass of `verifier` in <racine>, under the lock of the machine (<env> carries its mark): the
438
- // tests of the crates the changes since the last green touch, then cargo deny; green, it keeps the
439
- // last green.
577
+ // tests of the crates as tasks of Turborepo (every one played for real with <args> `--tout`), then
578
+ // cargo deny. It keeps no green.
440
579
  function verifier(racine, args, env) {
441
580
  const p = passe(racine, env);
442
581
  if (args.includes('--gardes')) {
443
582
  return gardes(racine, p);
444
583
  }
445
- const tous = crates(racine);
446
- const { choix, m } = depuisLeVert(racine, tous, args.includes('--tout'), env);
447
- try {
448
- jouerLesTests(
449
- racine,
450
- p,
451
- choix.map(c => ({ c, cibles: [] })),
452
- []
453
- )();
454
- p.jouer(p.prevoir(RACINE, racine, 'deny', false, ['deny', 'check']));
455
- const code = p.code();
456
- if (code === 0 && m.etat) {
457
- garderLeVert(m.etat);
458
- }
459
- return code;
460
- } finally {
461
- m.retirer();
462
- }
584
+ // Beside the module of package.json (composed command), its pass has played the tasks.
585
+ const { noms, absents } = env[GRAPHE_JOUE]
586
+ ? { noms: new Set(), absents: [] }
587
+ : nomsDuGraphe(racine, crates(racine));
588
+ direLesAbsents(absents);
589
+ const code = noms.size
590
+ ? lancerLesTaches({
591
+ outil: OUTIL,
592
+ racine,
593
+ taches: [SCRIPT_DES_TESTS],
594
+ noms,
595
+ tests: testsCibles({ arguments: [], force: args.includes('--tout') }),
596
+ env,
597
+ })
598
+ : 0;
599
+ p.jouer(p.prevoir(RACINE, racine, 'deny', false, ['deny', 'check']));
600
+ return code === 0 ? p.code() : 1;
463
601
  }
464
602
 
465
603
  // The scripts of guards of the project, in the order they play, as the module typescript's
@@ -489,12 +627,38 @@ const CACHE_DE_NODE = 'node-compile-cache';
489
627
  // Plays <jouer>(env) under the base of a pass of <genre> in the temporary directory of <env>,
490
628
  // named to cargo in TMPDIR, TMP and TEMP: its code, 1 when the tests left something there, named.
491
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.
492
635
  function sousLaBase(genre, env, jouer) {
493
636
  const base = ouvrirBase(genre, { dans: env.TMPDIR || tmpdir() });
494
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
+ };
495
657
  try {
496
- const code = jouer({ ...env, ...base.env });
497
- 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
+ );
498
662
  if (!ligne) {
499
663
  return code;
500
664
  }
@@ -508,16 +672,18 @@ function sousLaBase(genre, env, jouer) {
508
672
 
509
673
  /**
510
674
  * The line that refuses the workspace at <racine> whose Cargo.lock git does not track, the
511
- * gesture named; null when git tracks it.
675
+ * gesture named; null when git tracks it. <copie> is the root git reads (a tree of HEAD's version
676
+ * has no `.git`: its copy's, where the same file is tracked).
512
677
  * @param {string} racine
678
+ * @param {string} [copie]
513
679
  * @returns {string | null}
514
680
  */
515
- export function verrouNonVersionne(racine) {
681
+ export function verrouNonVersionne(racine, copie = racine) {
516
682
  if (!existsSync(path.join(racine, VERROU))) {
517
683
  return `⛔ ${VERROU} absent : cargo generate-lockfile, puis git add ${VERROU}`;
518
684
  }
519
685
  const r = spawnSync('git', ['ls-files', '--error-unmatch', '--', VERROU], {
520
- cwd: racine,
686
+ cwd: copie,
521
687
  stdio: 'ignore',
522
688
  });
523
689
  return r.status === 0 ? null : `⛔ ${VERROU} non versionné : git add ${VERROU}`;
@@ -530,14 +696,40 @@ export function verrouNonVersionne(racine) {
530
696
  * @param {{ racine?: string, env?: NodeJS.ProcessEnv }} [o]
531
697
  */
532
698
  export function lancer(nom, args, { racine = process.cwd(), env = process.env } = {}) {
699
+ // `construire` and `typer` with a path: the one crate of that folder (`cargo build -p`,
700
+ // `cargo check -p`), as Turborepo's task of one package; `typer` alone checks the workspace.
701
+ let crate = null;
702
+ // The launcher's `construire` (`--echec <fichier> <plan>`, scripts/enveloppe/lancer.sh) builds
703
+ // the copy for a session, the plan and its providers, as every language's.
704
+ if (nom === 'construire' && args.includes('--echec')) {
705
+ return construireDepuisLesArguments(OUTIL, args, racine);
706
+ }
707
+ if (nom === 'construire' || (nom === 'typer' && args.length)) {
708
+ const [chemin, ...autres] = args;
709
+ const abs = chemin === undefined ? null : path.resolve(racine, chemin);
710
+ crate = abs === null ? undefined : crates(racine).find(x => x.composant.dossier === abs);
711
+ if (!crate || autres.length) {
712
+ process.stderr.write(
713
+ `⛔ ${nom} : ${chemin ?? 'aucun chemin'} ne désigne pas un crate (un dossier de crate, une fois).\n`
714
+ );
715
+ return 2;
716
+ }
717
+ }
533
718
  const refus =
534
- (VERROUILLEES.includes(nom) ? verrouNonVersionne(racine) : null) ??
535
- (COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
719
+ (VERROUILLEES.includes(nom)
720
+ ? verrouNonVersionne(racine, env[COPIE_DE_L_ARBRE] || racine)
721
+ : null) ?? (COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
536
722
  if (refus) {
537
723
  process.stderr.write(`${refus}\n`);
538
724
  return 2;
539
725
  }
540
726
  const p = passe(racine, env);
727
+ if (crate) {
728
+ const sous = nom === 'construire' ? 'build' : 'check';
729
+ const nomDuCrate = crate.composant.nom;
730
+ p.jouer(p.prevoir(nomDuCrate, crate.composant.dossier, sous, false, [sous, '-p', nomDuCrate]));
731
+ return p.code();
732
+ }
541
733
  if (nom === 'typer') {
542
734
  p.jouer(p.prevoir(RACINE, racine, 'check', false, ['check', '--all-targets']));
543
735
  return p.code();
@@ -550,7 +742,7 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
550
742
  const dire = l => process.stdout.write(`${l}\n`);
551
743
  try {
552
744
  return sousLaBase('verification', env, envBase =>
553
- avecLaMachine(envMachine => verifier(racine, args, envMachine), {
745
+ avecLaMachineEtUnePlace(envMachine => verifier(racine, args, envMachine), {
554
746
  env: envBase,
555
747
  racine,
556
748
  dire,
@@ -566,22 +758,27 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
566
758
  }
567
759
  const tous = crates(racine);
568
760
  if (nom === 'tester') {
569
- return sousLaBase('tests', env, envBase => tester(racine, tous, args, envBase));
761
+ return surUnePlace(e => tester(racine, tous, args, e), { env });
762
+ }
763
+ if (nom === 'tests-du-paquet') {
764
+ return sousLaBase('tests', env, (envBase, pp) =>
765
+ testsDuPaquet(racine, tous, args, envBase, pp)
766
+ );
570
767
  }
571
768
  if (nom === 'tests-de-nuit') {
572
- return sousLaBase('tests', env, envBase => testsDeNuit(racine, tous, envBase));
769
+ return sousLaBase('tests', env, (envBase, pp) => testsDeNuit(racine, tous, envBase, pp));
573
770
  }
574
771
  process.stderr.write(`⛔ commande inconnue du module cargo : ${nom} (${NOMS.join(', ')})\n`);
575
772
  return 2;
576
773
  }
577
774
 
578
- // The pass of `tester` in <racine>, the crates <tous>, its arguments <args>, under <env>.
775
+ // The pass of `tester` in <racine>, the crates <tous>, its arguments <args>, under <env>: the tasks
776
+ // `test:unit` of the crates the paths choose (every crate without a path) as Turborepo's, the
777
+ // exit code its.
579
778
  function tester(racine, tous, args, env) {
580
- const p = passe(racine, env);
581
779
  const chemins = args.filter(a => !a.startsWith('-'));
582
780
  const options = args.filter(a => a.startsWith('-') && a !== '--force');
583
- let choix;
584
- let m = null;
781
+ let choisis = tous;
585
782
  if (chemins.length) {
586
783
  const r = choisir(racine, tous, chemins);
587
784
  if (r.refus) {
@@ -590,31 +787,93 @@ function tester(racine, tous, args, env) {
590
787
  }
591
788
  return 2;
592
789
  }
593
- choix = r.choix;
594
- } else if (env[DEPUIS_LE_VERT]) {
595
- ({ choix, m } = depuisLeVert(racine, tous, args.includes('--force'), env));
596
- choix = choix.map(c => ({ c, cibles: [] }));
597
- } else {
598
- choix = tous.map(c => ({ c, cibles: [] }));
790
+ choisis = r.choix.map(x => x.c);
599
791
  }
600
- try {
601
- jouerLesTests(racine, p, choix, options)();
602
- } finally {
603
- m?.retirer();
792
+ const { noms, absents } = nomsDuGraphe(racine, choisis);
793
+ if (chemins.length && absents.length) {
794
+ process.stderr.write(
795
+ `⛔ ${absents.join(', ')} : pas un paquet du graphe (package.json absent) : npx grillhouse maj\n`
796
+ );
797
+ return 2;
798
+ }
799
+ direLesAbsents(absents);
800
+ if (noms.size === 0) {
801
+ return 0;
802
+ }
803
+ return lancerLesTaches({
804
+ outil: OUTIL,
805
+ racine,
806
+ taches: [SCRIPT_DES_TESTS],
807
+ noms,
808
+ tests: testsCibles({
809
+ arguments: [...chemins.map(c => path.resolve(racine, c)), ...options],
810
+ force: args.includes('--force'),
811
+ }),
812
+ env,
813
+ });
814
+ }
815
+
816
+ // The pass of `tests-du-paquet` in <racine>, the crates <tous>, its arguments <args>, under <env>:
817
+ // the body of the task `test:unit` of a crate. The paths its script names, completed by those of
818
+ // the variable of the task that lie in the same crate.
819
+ function testsDuPaquet(racine, tous, args, env, parPaquet) {
820
+ const donnes = args.filter(a => !a.startsWith('-'));
821
+ if (donnes.length === 0) {
822
+ process.stderr.write(
823
+ '⛔ tests-du-paquet : aucun chemin (un dossier de crate, ou un fichier de test).\n'
824
+ );
825
+ return 2;
604
826
  }
827
+ const dossierDe = abs =>
828
+ composantDans(
829
+ tous.map(x => x.composant),
830
+ racine,
831
+ abs
832
+ )?.dossier ?? null;
833
+ const { chemins, options } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
834
+ const r = choisir(racine, tous, chemins);
835
+ if (r.refus) {
836
+ for (const l of r.refus) {
837
+ process.stderr.write(`⛔ ${l}\n`);
838
+ }
839
+ return 2;
840
+ }
841
+ const p = passe(racine, env);
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);
605
850
  return p.code();
606
851
  }
607
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
+
608
866
  // The pass of `tests-de-nuit` in <racine>, the crates <tous>, under <env>: the night tests and the
609
867
  // benches of each crate that holds some, each named.
610
- function testsDeNuit(racine, tous, env) {
868
+ function testsDeNuit(racine, tous, env, parPaquet) {
611
869
  const p = passe(racine, env);
612
870
  const choix = tous
613
871
  .filter(c => joueDesTests(racine, c.composant))
614
872
  .map(c => ({ c, cibles: c.cibles.filter(horsDuJour).map(t => t.name) }))
615
873
  .filter(x => x.cibles.length);
616
874
  if (choix.length) {
617
- jouerLesTests(racine, p, choix, [])();
875
+ jouerLesTests(racine, p, choix, [], parPaquet.temporaire)();
876
+ restesParPaquet(p, choix, parPaquet);
618
877
  }
619
878
  return p.code();
620
879
  }