@roomi-fields/grillhouse 0.28.3 → 0.30.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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +128 -26
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/README.md +11 -11
  7. package/cadre/templates/projet/_gitignore +2 -5
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/projet/package.json +2 -2
  10. package/charte.md +37 -4
  11. package/dist/temporal/acte.d.ts +24 -0
  12. package/dist/temporal/acte.js +139 -0
  13. package/dist/temporal/acte.js.map +1 -0
  14. package/dist/temporal/attributs.d.ts +6 -0
  15. package/dist/temporal/attributs.js +15 -0
  16. package/dist/temporal/attributs.js.map +1 -0
  17. package/dist/temporal/circuit/activites.d.ts +13 -0
  18. package/dist/temporal/circuit/activites.js +33 -0
  19. package/dist/temporal/circuit/activites.js.map +1 -0
  20. package/dist/temporal/circuit/client.d.ts +72 -0
  21. package/dist/temporal/circuit/client.js +247 -0
  22. package/dist/temporal/circuit/client.js.map +1 -0
  23. package/dist/temporal/circuit/commande.d.ts +2 -0
  24. package/dist/temporal/circuit/commande.js +238 -0
  25. package/dist/temporal/circuit/commande.js.map +1 -0
  26. package/dist/temporal/circuit/contrat.d.ts +305 -0
  27. package/dist/temporal/circuit/contrat.js +24 -0
  28. package/dist/temporal/circuit/contrat.js.map +1 -0
  29. package/dist/temporal/circuit/deroule.d.ts +3 -0
  30. package/dist/temporal/circuit/deroule.js +540 -0
  31. package/dist/temporal/circuit/deroule.js.map +1 -0
  32. package/dist/temporal/client.d.ts +47 -0
  33. package/dist/temporal/client.js +69 -0
  34. package/dist/temporal/client.js.map +1 -0
  35. package/dist/temporal/commande.d.ts +2 -0
  36. package/dist/temporal/commande.js +95 -0
  37. package/dist/temporal/commande.js.map +1 -0
  38. package/dist/temporal/deroules.d.ts +5 -0
  39. package/dist/temporal/deroules.js +10 -0
  40. package/dist/temporal/deroules.js.map +1 -0
  41. package/dist/temporal/etat.d.ts +33 -0
  42. package/dist/temporal/etat.js +59 -0
  43. package/dist/temporal/etat.js.map +1 -0
  44. package/dist/temporal/file/activites.d.ts +10 -0
  45. package/dist/temporal/file/activites.js +25 -0
  46. package/dist/temporal/file/activites.js.map +1 -0
  47. package/dist/temporal/file/client.d.ts +4 -0
  48. package/dist/temporal/file/client.js +6 -0
  49. package/dist/temporal/file/client.js.map +1 -0
  50. package/dist/temporal/file/contrat.d.ts +158 -0
  51. package/dist/temporal/file/contrat.js +14 -0
  52. package/dist/temporal/file/contrat.js.map +1 -0
  53. package/dist/temporal/file/deroule.d.ts +15 -0
  54. package/dist/temporal/file/deroule.js +235 -0
  55. package/dist/temporal/file/deroule.js.map +1 -0
  56. package/dist/temporal/installation.d.ts +124 -0
  57. package/dist/temporal/installation.js +408 -0
  58. package/dist/temporal/installation.js.map +1 -0
  59. package/dist/temporal/places/activites.d.ts +8 -0
  60. package/dist/temporal/places/activites.js +13 -0
  61. package/dist/temporal/places/activites.js.map +1 -0
  62. package/dist/temporal/places/client.d.ts +28 -0
  63. package/dist/temporal/places/client.js +64 -0
  64. package/dist/temporal/places/client.js.map +1 -0
  65. package/dist/temporal/places/contrat.d.ts +106 -0
  66. package/dist/temporal/places/contrat.js +21 -0
  67. package/dist/temporal/places/contrat.js.map +1 -0
  68. package/dist/temporal/places/deroule.d.ts +3 -0
  69. package/dist/temporal/places/deroule.js +198 -0
  70. package/dist/temporal/places/deroule.js.map +1 -0
  71. package/dist/temporal/sonde/activites.d.ts +6 -0
  72. package/dist/temporal/sonde/activites.js +52 -0
  73. package/dist/temporal/sonde/activites.js.map +1 -0
  74. package/dist/temporal/sonde/contrat.d.ts +35 -0
  75. package/dist/temporal/sonde/contrat.js +10 -0
  76. package/dist/temporal/sonde/contrat.js.map +1 -0
  77. package/dist/temporal/sonde/deroule.d.ts +3 -0
  78. package/dist/temporal/sonde/deroule.js +39 -0
  79. package/dist/temporal/sonde/deroule.js.map +1 -0
  80. package/dist/temporal/tickets/activites.d.ts +7 -0
  81. package/dist/temporal/tickets/activites.js +81 -0
  82. package/dist/temporal/tickets/activites.js.map +1 -0
  83. package/dist/temporal/tickets/client.d.ts +10 -0
  84. package/dist/temporal/tickets/client.js +31 -0
  85. package/dist/temporal/tickets/client.js.map +1 -0
  86. package/dist/temporal/tickets/contrat.d.ts +56 -0
  87. package/dist/temporal/tickets/contrat.js +13 -0
  88. package/dist/temporal/tickets/contrat.js.map +1 -0
  89. package/dist/temporal/tickets/deroule.d.ts +3 -0
  90. package/dist/temporal/tickets/deroule.js +94 -0
  91. package/dist/temporal/tickets/deroule.js.map +1 -0
  92. package/dist/temporal/travailleur.d.ts +2 -0
  93. package/dist/temporal/travailleur.js +69 -0
  94. package/dist/temporal/travailleur.js.map +1 -0
  95. package/docs/ARCHITECTURE.md +813 -53
  96. package/docs/CADRE.md +17 -0
  97. package/docs/INTERFACE.md +161 -30
  98. package/hooks/crochet.mjs +19 -2
  99. package/hooks/hooks.json +11 -0
  100. package/package.json +16 -4
  101. package/scripts/activites.mjs +2182 -0
  102. package/scripts/aiguillage.d.mts +37 -0
  103. package/scripts/aiguillage.mjs +328 -0
  104. package/scripts/avancement.mjs +159 -64
  105. package/scripts/bilan.mjs +37 -19
  106. package/scripts/cadre.mjs +11 -2
  107. package/scripts/circuit.mjs +888 -3654
  108. package/scripts/circuits-cles.d.mts +4 -0
  109. package/scripts/circuits-cles.mjs +21 -0
  110. package/scripts/circuits-du-serveur.mjs +105 -0
  111. package/scripts/codes-de-sortie.mjs +9 -0
  112. package/scripts/commandes-composees.mjs +45 -41
  113. package/scripts/commandes-du-path.d.mts +7 -0
  114. package/scripts/commandes-du-path.mjs +25 -0
  115. package/scripts/composition-des-langages.mjs +30 -11
  116. package/scripts/conformite.mjs +19 -10
  117. package/scripts/copies-finies.mjs +188 -42
  118. package/scripts/depart-du-ticket.d.mts +53 -0
  119. package/scripts/depart-du-ticket.mjs +124 -0
  120. package/scripts/dependances-internes.mjs +115 -0
  121. package/scripts/dernier-vert.mjs +7 -15
  122. package/scripts/donnees-cles.mjs +228 -0
  123. package/scripts/droits.mjs +11 -1
  124. package/scripts/effets.mjs +352 -0
  125. package/scripts/enveloppe/enveloppe.mjs +119 -8
  126. package/scripts/enveloppe/lancer.sh +27 -32
  127. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  128. package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
  129. package/scripts/etapes.mjs +6 -3
  130. package/scripts/faits-du-circuit.mjs +493 -0
  131. package/scripts/file-des-tickets.d.mts +21 -0
  132. package/scripts/file-des-tickets.mjs +58 -0
  133. package/scripts/flux-des-paquets.mjs +187 -0
  134. package/scripts/fusion-du-changelog.mjs +0 -1
  135. package/scripts/gardes-du-cadre.mjs +12 -2
  136. package/scripts/grillhouse-maj.mjs +16 -7
  137. package/scripts/integration/file.mjs +477 -422
  138. package/scripts/integration/integrer.mjs +20 -22
  139. package/scripts/integration/rejeu.mjs +19 -4
  140. package/scripts/jointure.d.ts +168 -28
  141. package/scripts/langages/cargo/commandes.mjs +426 -119
  142. package/scripts/langages/cargo/composants.mjs +187 -3
  143. package/scripts/langages/cargo/exemples.mjs +75 -17
  144. package/scripts/langages/cargo/index.mjs +32 -13
  145. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  146. package/scripts/langages/cargo/sccache.mjs +62 -16
  147. package/scripts/langages/cargo/squelette.mjs +72 -3
  148. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  149. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  150. package/scripts/langages/python/commandes.mjs +232 -79
  151. package/scripts/langages/python/composants.mjs +65 -3
  152. package/scripts/langages/python/exemples.mjs +21 -12
  153. package/scripts/langages/python/index.mjs +25 -5
  154. package/scripts/langages/python/lot.mjs +1 -36
  155. package/scripts/langages/python/squelette.mjs +119 -17
  156. package/scripts/langages/typescript/construire.mjs +6 -163
  157. package/scripts/langages/typescript/exemples.mjs +19 -11
  158. package/scripts/langages/typescript/frontieres.mjs +1 -1
  159. package/scripts/langages/typescript/index.mjs +48 -63
  160. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  161. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  162. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  163. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  164. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  165. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  166. package/scripts/langages/typescript/squelette.mjs +18 -2
  167. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  168. package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
  169. package/scripts/langages/typescript/tests.mjs +17 -8
  170. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  171. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  172. package/scripts/langages/typescript/verdict.mjs +1 -1
  173. package/scripts/langages/typescript/verifier.mjs +110 -296
  174. package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
  175. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  176. package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
  177. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  178. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  179. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  180. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
  181. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
  182. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  183. package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
  184. package/scripts/lecture-unique.mjs +51 -0
  185. package/scripts/mesure/pression.mjs +11 -9
  186. package/scripts/mesure-de-la-machine.d.mts +21 -0
  187. package/scripts/mesure-de-la-machine.mjs +76 -0
  188. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  189. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  190. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  191. package/scripts/migrations.mjs +5 -0
  192. package/scripts/nuit.sh +29 -15
  193. package/scripts/outil.mjs +72 -0
  194. package/scripts/outils-cles.d.mts +24 -0
  195. package/scripts/outils-cles.mjs +0 -1
  196. package/scripts/paquet-npm.mjs +147 -0
  197. package/scripts/paquet.mjs +112 -14
  198. package/scripts/paquets.mjs +34 -6
  199. package/scripts/passe-de-la-machine.mjs +66 -0
  200. package/scripts/places-de-la-machine.mjs +360 -0
  201. package/scripts/places-du-serveur.mjs +170 -0
  202. package/scripts/prefixe-des-tickets.mjs +68 -0
  203. package/scripts/preparation.mjs +10 -3
  204. package/scripts/registre.mjs +3 -2
  205. package/scripts/regles-des-places.d.mts +36 -0
  206. package/scripts/regles-des-places.mjs +70 -0
  207. package/scripts/reponses-du-circuit.d.mts +6 -0
  208. package/scripts/reponses-du-circuit.mjs +28 -0
  209. package/scripts/resultats.mjs +29 -14
  210. package/scripts/retirer-les-copies-finies.mjs +25 -0
  211. package/scripts/sans-reponse.d.mts +4 -0
  212. package/scripts/sans-reponse.mjs +13 -0
  213. package/scripts/seances.mjs +918 -0
  214. package/scripts/services-du-noyau.mjs +28 -11
  215. package/scripts/session-start.sh +10 -1
  216. package/scripts/sortie.mjs +23 -4
  217. package/scripts/sources.mjs +3 -3
  218. package/scripts/sous-commandes.mjs +39 -9
  219. package/scripts/style-a-l-ecriture.mjs +229 -0
  220. package/scripts/superviseur.mjs +382 -16
  221. package/scripts/tableau.mjs +329 -130
  222. package/scripts/taches-du-graphe.mjs +328 -0
  223. package/scripts/ticket-du-circuit.mjs +206 -0
  224. package/scripts/transitions.d.mts +148 -0
  225. package/scripts/transitions.mjs +901 -0
  226. package/scripts/verrou-de-fichier.mjs +2 -2
  227. package/scripts/verrou-de-machine.mjs +322 -62
  228. package/skills/developpeur/SKILL.md +11 -3
  229. package/skills/explorateur/SKILL.md +2 -1
  230. package/skills/pitmaster/SKILL.md +62 -28
  231. package/skills/pitmaster/references/consigne-agent.md +5 -1
  232. package/skills/release/SKILL.md +3 -3
  233. package/skills/relecteur/SKILL.md +22 -8
  234. package/skills/testwriter/SKILL.md +47 -39
  235. package/scripts/demon.mjs +0 -138
  236. package/scripts/integration/file-attente.mjs +0 -61
  237. package/scripts/langages/cargo/touches.mjs +0 -93
  238. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -4,42 +4,77 @@
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
10
- // npx grillhouse clippy | frontieres | index-interfaces each guard, its own script
11
+ // npx grillhouse tests-de-nuit tests-de-nuit
12
+ // npx grillhouse tailles-des-tests | clippy | frontieres | index-interfaces
13
+ // each guard, its own script
11
14
  //
12
- // - Each guard of structure of the module (./clippy.mjs, ./frontieres.mjs, ./index-interfaces.mjs)
13
- // is a command by its name too, its own script, as the module typescript's: the line of a red
15
+ // - Each guard of structure of the module (./tailles-des-tests.mjs, ./clippy.mjs,
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
14
17
  // guard (`grillhouse <garde>`, scripts/gardes-du-cadre.mjs) names a command that exists.
15
- // - `tester` plays the tests of each crate chosen, one crate after the other. For a crate that
16
- // plays tests (./composants.mjs, `joueDesTests`): the build of its test targets, `cargo test
17
- // --no-run -p <crate>`, a task `build` of its own, as Turborepo's `test` depends on `build`
18
- // (grillhouse-egm); then `cargo nextest run -p <crate> --no-fail-fast`, which finds them built.
19
- // Then `cargo test --doc -p <crate>` for a crate whose library has doctests, which nextest does
20
- // not play. A failed build leaves the crate's other tasks not played (`code` null): a test that
21
- // does not compile is a red of the build, which the proof of the red reads as one (« construction
22
- // de <crate> », scripts/circuit.mjs), and the tests play at the checks. The output of the build
23
- // goes to its log, `<target>/grillhouse/<crate>-build.log`, the task's `journal` from the root,
24
- // then to the error stream. A path, written from the root, chooses the crate that holds it; the
25
- // source of a test target (`<crate>/tests/<nom>.rs`) builds and plays that target alone
26
- // (`--test <nom>`), without the doctests. A path out of every crate, or in a crate without tests, is refused, named, and
27
- // nothing plays (code 2). Without a path, every crate plays, or, under the circuit's mark
28
- // (`GRILLHOUSE_DEPUIS_LE_VERT`), the crates the changes since the last green touch and their
29
- // dependents (./touches.mjs), every crate when no last green counts. `--force` changes nothing:
30
- // cargo keeps no result of a test to replay. Another option goes to nextest.
31
- // - `verifier` plays the tests of the crates the changes since the last green touch and of their
32
- // dependents (every crate with `--tout`, or when no last green counts), as Turborepo's
33
- // `--filter=...[<commit>]`, then `cargo deny check`; green, it keeps the last green
34
- // (scripts/dernier-vert.mjs). It plays under the lock of the machine, one heavy measure at a
35
- // time (`avecLaMachine` of ./jointure, as the module typescript's verifier): a measure that
36
- // holds it makes it wait, and the bound of the wait reached, it stops at 75 without running
37
- // cargo.
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.
48
+ // - A test target is named by its file, as `*_nuit_test.py` and `*.budget.test.*` (grillhouse-wbk):
49
+ // `tests/<nom>_nuit.rs` (or `tests/<nom>_nuit/main.rs`, the target `<nom>_nuit`) is a night
50
+ // test, `tests/<nom>_budget.rs` a time budget bench. A crate played whole leaves both out of
51
+ // nextest, in `tester` as in `verifier`, which then plays its library (`--lib`), its binaries
52
+ // (`--bins`) and each other test target (`--test <nom>`); its build still compiles them. The
53
+ // night plays them (`tests-de-nuit`), as the module typescript's `*.budget.test.*`. A path that
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.
57
+ // - A time budget bench plays alone, one test at a time (`--test-threads 1`), in a task `budget` of
58
+ // its own after the other tests: in `tests-de-nuit` and in a path that names it. A red of the
59
+ // task while the CPU pressure of the machine (`lirePression` of ./jointure) is at or above its
60
+ // threshold at its start or at its end is « à repasser », 75, said in one line with the
61
+ // pressure; at rest, a red.
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.
38
73
  // - `verifier --gardes` plays the guards alone, the same verdict as the module typescript's: the
39
74
  // project's root scripts `grillhouse:gardes` (the frame's guards) then `gardes` (its own), each
40
75
  // one the package.json holds a task of the root, by npm, without its tests nor cargo deny, and
41
76
  // keeps no last green.
42
- // - `tester` and `verifier` 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
43
78
  // the temporary directory, as the CI of osc-bridge (OB-ud1.3): a base (`ouvrirBase` of
44
79
  // ./jointure, genre `tests` or `verification`) in the temporary directory of the environment,
45
80
  // named in TMPDIR, TMP and TEMP to cargo, which nextest and the doctests inherit; removed at the
@@ -47,20 +82,24 @@
47
82
  // fails the pass (code 1), each name written on the error stream. A test makes its temporary
48
83
  // directory or file with the crate `tempfile` (`TempDir`, `NamedTempFile`), removed when dropped,
49
84
  // a failed test included, never a path built by hand under `std::env::temp_dir()`.
85
+ // - `tests-de-nuit`: the night tests then the benches of each crate that holds some; none, nothing
86
+ // plays and the code is 0. The night (scripts/nuit.sh) runs it after the full pass, and plays it
87
+ // again at rest after a 75.
50
88
  // - `typer`: `cargo check --all-targets`. `preparer`: `cargo fetch --locked`.
51
89
  // - Cargo runs with rustc wrapped by sccache, its cache common to the copies of the machine
52
90
  // (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr), its server started
53
- // under the machine's /tmp before each run of cargo that compiles (grillhouse-qmk). `tester`, `verifier`
54
- // 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
55
93
  // and `npx grillhouse maj`, which installs it (code 2).
56
94
  // - Nextest reads the frame's profile `grillhouse` (./nextest.toml, a tool's configuration under
57
- // the project's own, `--tool-config-file`), whose JUnit report lands at
58
- // `<target>/nextest/grillhouse/junit.xml`.
95
+ // the project's own, `--tool-config-file`), whose JUnit report lands in nextest's store, at
96
+ // `<workspace root>/target/nextest/grillhouse/junit.xml` (nextest's default `store.dir`, under
97
+ // the workspace's root, even when the compilations' target directory lies elsewhere).
59
98
  // - While the environment names a results directory (`GRILLHOUSE_RESULTATS`), the run writes
60
99
  // there what ./verdict.mjs reads: its tasks, each planned before it plays (`code` null until it
61
100
  // ran), and the JUnit report of each run of nextest. A task of the workspace is named after its
62
101
  // root, `//`, as Turborepo names the root's tasks.
63
- // - `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
64
103
  // Cargo.lock git does not track (grillhouse-rph), in one line that names the file and the
65
104
  // gesture: `git add Cargo.lock`, or `cargo generate-lockfile` first when it is absent. Cargo
66
105
  // recommends committing it for every project, and the verification plays the exact versions of
@@ -69,6 +108,10 @@
69
108
  // git, the integration's.
70
109
  // - The exit code: 0 when every task is green, 75 when the only reds are « à repasser », 1
71
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.
72
115
  import { spawnSync } from 'node:child_process';
73
116
  import {
74
117
  closeSync,
@@ -86,37 +129,94 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
86
129
  import { RESULTATS } from '../../resultats.mjs';
87
130
  import {
88
131
  AttenteDeLaMachine,
89
- avecLaMachine,
90
- CHANGEMENTS,
91
- DEPUIS_LE_VERT,
92
- garderLeVert,
132
+ surUnePlace,
133
+ avecLaMachineEtUnePlace,
134
+ cheminsDeLaTache,
135
+ construireDepuisLesArguments,
136
+ ecrirePression,
137
+ GRAPHE_JOUE,
138
+ lancerLesTaches,
93
139
  ligneDesRestes,
94
- mesure,
140
+ lirePression,
141
+ nomDuPaquet,
95
142
  ouvrirBase,
96
143
  retirerALInterruption,
144
+ SCRIPT_DES_TESTS,
145
+ SEUIL_PRESSION,
146
+ testsCibles,
147
+ travailleursDeLaSeance,
97
148
  } from '../../services-du-noyau.mjs';
98
- import { composantDans, crates, joueDesTests, metadonnees } from './composants.mjs';
149
+ import {
150
+ BANC,
151
+ COPIE_DE_L_ARBRE,
152
+ composantDans,
153
+ crates,
154
+ DE_NUIT,
155
+ joueDesTests,
156
+ metadonnees,
157
+ } from './composants.mjs';
99
158
  import { avecSccache, demarrerLeServeur, sccacheAbsent } from './sccache.mjs';
100
- import { touchesDesFichiers } from './touches.mjs';
101
159
  import { JUNIT, TACHES } from './verdict.mjs';
102
160
 
103
161
  const ICI = fileURLToPath(import.meta.url);
104
162
  const NEXTEST = path.join(path.dirname(ICI), 'nextest.toml');
105
163
  const PROFIL = 'grillhouse';
106
- export const NOMS = ['tester', 'verifier', 'typer', 'preparer'];
164
+ export const NOMS = [
165
+ 'tester',
166
+ 'tests-du-paquet',
167
+ 'verifier',
168
+ 'typer',
169
+ 'construire',
170
+ 'preparer',
171
+ 'tests-de-nuit',
172
+ ];
173
+ // The task runner of the graph of the packages.
174
+ const OUTIL = 'turbo';
107
175
  const A_REPASSER = 75;
108
176
  const RACINE = '//';
177
+ // The task of the time budget benches of a crate.
178
+ const BUDGET = 'budget';
109
179
  const VERROU = 'Cargo.lock';
110
180
  // The commands that play the exact versions of the repository, refused without its Cargo.lock.
111
- const VERROUILLEES = ['tester', 'verifier', 'preparer'];
181
+ const VERROUILLEES = ['tests-du-paquet', 'verifier', 'preparer', 'tests-de-nuit'];
112
182
  // The commands that compile, refused without sccache on the PATH (./sccache.mjs).
113
- const COMPILENT = ['tester', 'verifier', 'typer'];
183
+ const COMPILENT = ['tests-du-paquet', 'verifier', 'typer', 'construire', 'tests-de-nuit'];
184
+ // The kinds of a target that are no library.
185
+ const PAS_UNE_BIBLIOTHEQUE = ['test', 'bin', 'example', 'bench', 'custom-build'];
186
+
187
+ /**
188
+ * Whether the target <t> of a crate is a test target out of the day: `nuit`, `banc`, or null.
189
+ * @param {{ kind: string[], name: string }} t
190
+ */
191
+ export function horsDuJour(t) {
192
+ if (!t.kind.includes('test')) {
193
+ return null;
194
+ }
195
+ if (t.name.endsWith(DE_NUIT)) {
196
+ return 'nuit';
197
+ }
198
+ return t.name.endsWith(BANC) ? 'banc' : null;
199
+ }
200
+
201
+ /**
202
+ * Whether the test file <chemin> (from the root <racine>) is a test target out of the day, a night
203
+ * test or a time budget bench (`horsDuJour`); false for any other file, a unit test of `src/`
204
+ * included.
205
+ * @param {string} chemin
206
+ * @param {string} racine
207
+ */
208
+ export function fichierHorsDuJour(chemin, racine) {
209
+ const abs = path.resolve(racine, chemin);
210
+ const c = crates(racine).find(x => x.cibles.some(t => t.src === abs));
211
+ return Boolean(c?.cibles.some(t => t.src === abs && horsDuJour(t) !== null));
212
+ }
114
213
  // The subcommands of cargo that compile, before which the server of sccache starts.
115
- const COMPILATIONS = ['test', 'nextest', 'check'];
214
+ const COMPILATIONS = ['test', 'nextest', 'check', 'build'];
116
215
 
117
216
  /** The guards of structure of the module, in the order they play: each its name, its script beside
118
217
  * this one, and its arguments as a guard. */
119
218
  export const GARDES = [
219
+ { nom: 'tailles-des-tests', args: [] },
120
220
  { nom: 'clippy', args: [] },
121
221
  { nom: 'frontieres', args: [] },
122
222
  { nom: 'index-interfaces', args: ['--verifier'] },
@@ -156,6 +256,8 @@ function passe(racine, env) {
156
256
  const cibles = {};
157
257
  // Cargo compiles through sccache (./sccache.mjs).
158
258
  const compilation = avecSccache(racine, env);
259
+ // The CPU pressure of the machine, the file <env> names or the kernel's.
260
+ const pression = () => lirePression(env.GRILLHOUSE_PRESSION_CPU || undefined);
159
261
  const ecrire = () => {
160
262
  if (!dossier) {
161
263
  return;
@@ -192,6 +294,8 @@ function passe(racine, env) {
192
294
  if (COMPILATIONS.includes(args[0])) {
193
295
  demarrerLeServeur(racine, env);
194
296
  }
297
+ const banc = t.script === BUDGET;
298
+ const avant = banc ? pression() : null;
195
299
  let r;
196
300
  if (journal) {
197
301
  // The output of cargo, both streams in their order, goes to the task's log, then to the
@@ -215,7 +319,11 @@ function passe(racine, env) {
215
319
  t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
216
320
  if (junit && dossier && existsSync(junit)) {
217
321
  mkdirSync(path.join(dossier, JUNIT), { recursive: true });
218
- copyFileSync(junit, path.join(dossier, JUNIT, `${id}-${t.paquet}.xml`));
322
+ const suffixe = t.script === 'nextest' ? '' : `-${t.script}`;
323
+ copyFileSync(junit, path.join(dossier, JUNIT, `${id}-${t.paquet}${suffixe}.xml`));
324
+ }
325
+ if (banc && t.code !== 0) {
326
+ sousCharge(t, [avant, pression()]);
219
327
  }
220
328
  ecrire();
221
329
  return t.code;
@@ -230,59 +338,135 @@ function passe(racine, env) {
230
338
  };
231
339
  }
232
340
 
233
- // The crates the changes since the last green of <racine> touch, and their dependents; every crate
234
- // with <tout> or without a last green that counts. `{ choix, m }`, `m` the measure.
235
- function depuisLeVert(racine, tous, tout, env) {
236
- const m = mesure(racine, { tout, dans: env.TMPDIR });
237
- process.stderr.write(`${m.ligne}\n`);
238
- const f = m.env[CHANGEMENTS];
239
- if (!f) {
240
- return { choix: tous, m };
241
- }
242
- const ch = JSON.parse(readFileSync(f, 'utf8'));
243
- const t = touchesDesFichiers(racine, [...ch.fichiers, ...ch.supprimes]);
244
- const nommes = new Set([...t.touches, ...t.dependants].map(c => c.dossier));
245
- return { choix: tous.filter(c => nommes.has(c.composant.dossier)), m };
341
+ // A red of the time budget benches of the task <t>, the pressures <pressions> measured at its start
342
+ // and at its end: « à repasser » (75) when one is at or above the threshold, said; else its code
343
+ // stands, a pressure that does not read said.
344
+ function sousCharge(t, pressions) {
345
+ const lues = pressions.filter(p => p !== null);
346
+ if (lues.length === 0) {
347
+ process.stderr.write(`⏱ banc de temps de ${t.paquet} rouge, pression CPU illisible : rouge.\n`);
348
+ return;
349
+ }
350
+ const haute = Math.max(...lues);
351
+ if (haute < SEUIL_PRESSION) {
352
+ return;
353
+ }
354
+ process.stderr.write(
355
+ `⏱ banc de temps de ${t.paquet} rouge sous charge (pression CPU ${ecrirePression(haute)}, seuil ${SEUIL_PRESSION} %) : à repasser (${A_REPASSER}).\n`
356
+ );
357
+ t.code = A_REPASSER;
246
358
  }
247
359
 
248
- // Plans and plays the tests of the crates <choix> (each `{ c, cibles }`, `cibles` the test targets
249
- // named, empty for the whole crate) in the run <p>: for a crate that plays tests, the build of its
250
- // test targets first, then nextest, then its doctests; a failed build leaves the crate's other
251
- // tasks not played.
360
+ // Plans and plays the tests of the crates <choix> in the run <p>, each `{ c, cibles }`: `cibles`
361
+ // the test targets named, empty for the whole crate of the day (its night tests and its benches
362
+ // left out). For a crate that plays tests:
363
+ // the build of its test targets first, then nextest, then its doctests; a failed build leaves the
364
+ // crate's other tasks not played. The benches named, each crate's in a task `budget`, are
365
+ // planned with the rest and played by the function this one returns, after the other tests.
252
366
  function jouerLesTests(racine, p, choix, options) {
253
367
  const m = metadonnees(racine);
254
- const junit = path.join(m.target_directory, 'nextest', PROFIL, 'junit.xml');
368
+ // Nextest's store is `target/nextest` under the workspace's root (its default `store.dir`),
369
+ // whatever the target directory of the compilations (./sccache.mjs).
370
+ const junit = path.join(m.workspace_root, 'target', 'nextest', PROFIL, 'junit.xml');
371
+ const nextest = ['nextest', 'run', '--tool-config-file', `${PROFIL}:${NEXTEST}`];
372
+ nextest.push('--profile', PROFIL, '--no-fail-fast');
373
+ // The workers of a session of an agent (GRILLHOUSE_TRAVAILLEURS): `-j` of cargo and of nextest;
374
+ // a heavy pass, without it, keeps every core.
375
+ const travailleurs = travailleursDeLaSeance(process.env);
376
+ const j = travailleurs === null ? [] : ['-j', String(travailleurs)];
377
+ // A bench plays on one thread (`--test-threads 1`, which `-j` of nextest is the alias of): it
378
+ // takes the arguments without `-j`.
379
+ const nextestDuBanc = [...nextest];
380
+ nextest.push(...j);
255
381
  const parCrate = [];
256
- for (const { c, cibles } of choix) {
382
+ const bancs = [];
383
+ for (const { c, cibles: nommees, jour } of choix) {
384
+ // Targets named beside the day of the crate (`jour`, a unit test of `src/` named): the day
385
+ // builds whole, and plays besides the targets named.
386
+ const cibles = jour && nommees.length === 0 ? [] : nommees;
387
+ const avecLeJour = Boolean(jour) && nommees.length > 0;
257
388
  Object.assign(p.cibles, binaires(c));
258
389
  const d = c.composant.dossier;
259
390
  const nom = c.composant.nom;
260
391
  const prevues = [];
392
+ const etat = { construit: true };
261
393
  if (joueDesTests(racine, c.composant)) {
262
- const selection = ['-p', nom, ...cibles.flatMap(n => ['--test', n])];
394
+ const tests = c.cibles.filter(t => t.kind.includes('test'));
395
+ const deBanc = n => tests.some(t => t.name === n && horsDuJour(t) === 'banc');
396
+ const desBancs = cibles.filter(deBanc);
397
+ const autres = cibles.filter(n => !deBanc(n));
263
398
  const journal = path.join(m.target_directory, 'grillhouse', `${nom}-build.log`);
264
- const construction = ['test', '--no-run', ...selection];
399
+ const construction = [
400
+ 'test',
401
+ '--no-run',
402
+ ...j,
403
+ '-p',
404
+ nom,
405
+ ...(avecLeJour ? [] : cibles.flatMap(n => ['--test', n])),
406
+ ];
265
407
  prevues.push([p.prevoir(nom, d, 'build', false, construction), { journal }]);
266
- const args = ['nextest', 'run', '--tool-config-file', `${PROFIL}:${NEXTEST}`];
267
- args.push('--profile', PROFIL, '--no-fail-fast', ...selection);
268
- prevues.push([p.prevoir(nom, d, 'nextest', true, [...args, ...options]), { junit }]);
408
+ if (cibles.length === 0 || autres.length || avecLeJour) {
409
+ const duC = duJour(c);
410
+ const nommes = autres.flatMap(n => ['--test', n]);
411
+ const selection = !cibles.length
412
+ ? duC
413
+ : avecLeJour
414
+ ? duC.length
415
+ ? [...duC, ...nommes]
416
+ : []
417
+ : nommes;
418
+ const args = [...nextest, '-p', nom, ...selection, ...options];
419
+ prevues.push([p.prevoir(nom, d, 'nextest', true, args), { junit }]);
420
+ }
421
+ if (desBancs.length) {
422
+ const args = [...nextestDuBanc, '-p', nom, ...desBancs.flatMap(n => ['--test', n])];
423
+ bancs.push({ nom, d, args: [...args, '--test-threads', '1', ...options], etat });
424
+ }
269
425
  }
270
426
  const doctests = c.cibles.some(t => t.kind.includes('lib') && t.doctest !== false);
271
- if (cibles.length === 0 && doctests) {
272
- const args = ['test', '--doc', '-p', nom];
427
+ if ((cibles.length === 0 || avecLeJour) && doctests) {
428
+ const args = ['test', '--doc', ...j, '-p', nom];
273
429
  prevues.push([p.prevoir(nom, d, 'doctest', true, args), {}]);
274
430
  }
275
- parCrate.push(prevues);
431
+ parCrate.push([prevues, etat]);
276
432
  }
277
- for (const prevues of parCrate) {
433
+ const prevusBancs = bancs.map(b => [p.prevoir(b.nom, b.d, BUDGET, true, b.args), b.etat]);
434
+ for (const [prevues, etat] of parCrate) {
278
435
  for (const [t, o] of prevues) {
279
436
  if (p.jouer(t, o) !== 0 && t.t.script === 'build') {
437
+ etat.construit = false;
280
438
  break;
281
439
  }
282
440
  }
283
441
  }
442
+ return () => {
443
+ for (const [t, etat] of prevusBancs) {
444
+ if (etat.construit) {
445
+ p.jouer(t, { junit });
446
+ }
447
+ }
448
+ };
449
+ }
450
+
451
+ // The selection of nextest of the crate <c> played whole in the day: none when it has no night
452
+ // test nor bench; else its library, its binaries and each other test target, named.
453
+ function duJour(c) {
454
+ const tests = c.cibles.filter(t => t.kind.includes('test'));
455
+ if (!tests.some(horsDuJour)) {
456
+ return [];
457
+ }
458
+ const lib = c.cibles.some(t => !t.kind.some(k => PAS_UNE_BIBLIOTHEQUE.includes(k)));
459
+ const bins = c.cibles.some(t => t.kind.includes('bin'));
460
+ return [
461
+ ...(lib ? ['--lib'] : []),
462
+ ...(bins ? ['--bins'] : []),
463
+ ...tests.filter(t => !horsDuJour(t)).flatMap(t => ['--test', t.name]),
464
+ ];
284
465
  }
285
466
 
467
+ // The refusal of a night test named in a targeted run: the night alone plays it.
468
+ const REFUS_DE_NUIT = 'un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)';
469
+
286
470
  // The crates the paths <chemins> choose in <racine>: `{ choix }`, or `{ refus }` naming each path
287
471
  // refused.
288
472
  function choisir(racine, tous, chemins) {
@@ -300,18 +484,27 @@ function choisir(racine, tous, chemins) {
300
484
  refus.push(`${chemin} : hors de tout crate`);
301
485
  continue;
302
486
  }
303
- if (!joueDesTests(racine, c)) {
487
+ // The folder of a crate without tests plays whole (its doctests, as the task of its package
488
+ // does); any other path in it names a test that does not exist.
489
+ if (!joueDesTests(racine, c) && abs !== c.dossier) {
304
490
  refus.push(`${chemin} : ${c.nom} n'a aucun test, ni dossier tests/, ni tests.rs sous src/`);
305
491
  continue;
306
492
  }
307
493
  const cible = crate.cibles.find(t => t.kind.includes('test') && t.src === abs);
494
+ // A night test plays at night alone (`tests-de-nuit`): a targeted run refuses it, named.
495
+ if (cible && horsDuJour(cible) === 'nuit') {
496
+ refus.push(`${chemin} : ${REFUS_DE_NUIT}`);
497
+ continue;
498
+ }
308
499
  const deja = parDossier.get(c.dossier);
500
+ // A file with no target of its own (a unit test of `src/`) asks for the day of its crate; a
501
+ // target named stays named, whatever the order of the paths.
502
+ const entree = deja ?? { c: crate, cibles: [], jour: false };
503
+ parDossier.set(c.dossier, entree);
309
504
  if (!cible) {
310
- parDossier.set(c.dossier, { c: crate, cibles: [] });
311
- } else if (!deja) {
312
- parDossier.set(c.dossier, { c: crate, cibles: [cible.name] });
313
- } else if (deja.cibles.length) {
314
- deja.cibles.push(cible.name);
505
+ entree.jour = true;
506
+ } else {
507
+ entree.cibles.push(cible.name);
315
508
  }
316
509
  }
317
510
  if (refus.length) {
@@ -324,32 +517,57 @@ function choisir(racine, tous, chemins) {
324
517
  };
325
518
  }
326
519
 
520
+ // The packages of the graph of the crates <crates>: `{ noms, absents }`, the names of those that are
521
+ // packages of the graph, and the names of the crates that are not.
522
+ function nomsDuGraphe(racine, crates) {
523
+ const noms = new Set();
524
+ const absents = [];
525
+ for (const c of crates) {
526
+ const nom = nomDuPaquet(racine, c.composant.dossier);
527
+ if (nom === null) {
528
+ absents.push(c.composant.nom);
529
+ } else {
530
+ noms.add(nom);
531
+ }
532
+ }
533
+ return { noms, absents };
534
+ }
535
+
536
+ // Says, on the error stream, each crate of <absents> that is no package of the graph: its tests do
537
+ // not play, as a package without a `package.json` is out of Turborepo's tasks.
538
+ function direLesAbsents(absents) {
539
+ for (const nom of absents) {
540
+ process.stderr.write(
541
+ `⚠️ ${nom} : pas un paquet du graphe (package.json absent) ; ses tests ne se jouent pas : npx grillhouse maj\n`
542
+ );
543
+ }
544
+ }
545
+
327
546
  // The pass of `verifier` in <racine>, under the lock of the machine (<env> carries its mark): the
328
- // tests of the crates the changes since the last green touch, then cargo deny; green, it keeps the
329
- // last green.
547
+ // tests of the crates as tasks of Turborepo (every one played for real with <args> `--tout`), then
548
+ // cargo deny. It keeps no green.
330
549
  function verifier(racine, args, env) {
331
550
  const p = passe(racine, env);
332
551
  if (args.includes('--gardes')) {
333
552
  return gardes(racine, p);
334
553
  }
335
- const tous = crates(racine);
336
- const { choix, m } = depuisLeVert(racine, tous, args.includes('--tout'), env);
337
- try {
338
- jouerLesTests(
339
- racine,
340
- p,
341
- choix.map(c => ({ c, cibles: [] })),
342
- []
343
- );
344
- p.jouer(p.prevoir(RACINE, racine, 'deny', false, ['deny', 'check']));
345
- const code = p.code();
346
- if (code === 0 && m.etat) {
347
- garderLeVert(m.etat);
348
- }
349
- return code;
350
- } finally {
351
- m.retirer();
352
- }
554
+ // Beside the module of package.json (composed command), its pass has played the tasks.
555
+ const { noms, absents } = env[GRAPHE_JOUE]
556
+ ? { noms: new Set(), absents: [] }
557
+ : nomsDuGraphe(racine, crates(racine));
558
+ direLesAbsents(absents);
559
+ const code = noms.size
560
+ ? lancerLesTaches({
561
+ outil: OUTIL,
562
+ racine,
563
+ taches: [SCRIPT_DES_TESTS],
564
+ noms,
565
+ tests: testsCibles({ arguments: [], force: args.includes('--tout') }),
566
+ env,
567
+ })
568
+ : 0;
569
+ p.jouer(p.prevoir(RACINE, racine, 'deny', false, ['deny', 'check']));
570
+ return code === 0 ? p.code() : 1;
353
571
  }
354
572
 
355
573
  // The scripts of guards of the project, in the order they play, as the module typescript's
@@ -398,16 +616,18 @@ function sousLaBase(genre, env, jouer) {
398
616
 
399
617
  /**
400
618
  * The line that refuses the workspace at <racine> whose Cargo.lock git does not track, the
401
- * gesture named; null when git tracks it.
619
+ * gesture named; null when git tracks it. <copie> is the root git reads (a tree of HEAD's version
620
+ * has no `.git`: its copy's, where the same file is tracked).
402
621
  * @param {string} racine
622
+ * @param {string} [copie]
403
623
  * @returns {string | null}
404
624
  */
405
- export function verrouNonVersionne(racine) {
625
+ export function verrouNonVersionne(racine, copie = racine) {
406
626
  if (!existsSync(path.join(racine, VERROU))) {
407
627
  return `⛔ ${VERROU} absent : cargo generate-lockfile, puis git add ${VERROU}`;
408
628
  }
409
629
  const r = spawnSync('git', ['ls-files', '--error-unmatch', '--', VERROU], {
410
- cwd: racine,
630
+ cwd: copie,
411
631
  stdio: 'ignore',
412
632
  });
413
633
  return r.status === 0 ? null : `⛔ ${VERROU} non versionné : git add ${VERROU}`;
@@ -420,14 +640,40 @@ export function verrouNonVersionne(racine) {
420
640
  * @param {{ racine?: string, env?: NodeJS.ProcessEnv }} [o]
421
641
  */
422
642
  export function lancer(nom, args, { racine = process.cwd(), env = process.env } = {}) {
643
+ // `construire` and `typer` with a path: the one crate of that folder (`cargo build -p`,
644
+ // `cargo check -p`), as Turborepo's task of one package; `typer` alone checks the workspace.
645
+ let crate = null;
646
+ // The launcher's `construire` (`--echec <fichier> <plan>`, scripts/enveloppe/lancer.sh) builds
647
+ // the copy for a session, the plan and its providers, as every language's.
648
+ if (nom === 'construire' && args.includes('--echec')) {
649
+ return construireDepuisLesArguments(OUTIL, args, racine);
650
+ }
651
+ if (nom === 'construire' || (nom === 'typer' && args.length)) {
652
+ const [chemin, ...autres] = args;
653
+ const abs = chemin === undefined ? null : path.resolve(racine, chemin);
654
+ crate = abs === null ? undefined : crates(racine).find(x => x.composant.dossier === abs);
655
+ if (!crate || autres.length) {
656
+ process.stderr.write(
657
+ `⛔ ${nom} : ${chemin ?? 'aucun chemin'} ne désigne pas un crate (un dossier de crate, une fois).\n`
658
+ );
659
+ return 2;
660
+ }
661
+ }
423
662
  const refus =
424
- (VERROUILLEES.includes(nom) ? verrouNonVersionne(racine) : null) ??
425
- (COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
663
+ (VERROUILLEES.includes(nom)
664
+ ? verrouNonVersionne(racine, env[COPIE_DE_L_ARBRE] || racine)
665
+ : null) ?? (COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
426
666
  if (refus) {
427
667
  process.stderr.write(`${refus}\n`);
428
668
  return 2;
429
669
  }
430
670
  const p = passe(racine, env);
671
+ if (crate) {
672
+ const sous = nom === 'construire' ? 'build' : 'check';
673
+ const nomDuCrate = crate.composant.nom;
674
+ p.jouer(p.prevoir(nomDuCrate, crate.composant.dossier, sous, false, [sous, '-p', nomDuCrate]));
675
+ return p.code();
676
+ }
431
677
  if (nom === 'typer') {
432
678
  p.jouer(p.prevoir(RACINE, racine, 'check', false, ['check', '--all-targets']));
433
679
  return p.code();
@@ -440,7 +686,7 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
440
686
  const dire = l => process.stdout.write(`${l}\n`);
441
687
  try {
442
688
  return sousLaBase('verification', env, envBase =>
443
- avecLaMachine(envMachine => verifier(racine, args, envMachine), {
689
+ avecLaMachineEtUnePlace(envMachine => verifier(racine, args, envMachine), {
444
690
  env: envBase,
445
691
  racine,
446
692
  dire,
@@ -456,19 +702,25 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
456
702
  }
457
703
  const tous = crates(racine);
458
704
  if (nom === 'tester') {
459
- return sousLaBase('tests', env, envBase => tester(racine, tous, args, envBase));
705
+ return surUnePlace(e => tester(racine, tous, args, e), { env });
706
+ }
707
+ if (nom === 'tests-du-paquet') {
708
+ return sousLaBase('tests', env, envBase => testsDuPaquet(racine, tous, args, envBase));
709
+ }
710
+ if (nom === 'tests-de-nuit') {
711
+ return sousLaBase('tests', env, envBase => testsDeNuit(racine, tous, envBase));
460
712
  }
461
713
  process.stderr.write(`⛔ commande inconnue du module cargo : ${nom} (${NOMS.join(', ')})\n`);
462
714
  return 2;
463
715
  }
464
716
 
465
- // The pass of `tester` in <racine>, the crates <tous>, its arguments <args>, under <env>.
717
+ // The pass of `tester` in <racine>, the crates <tous>, its arguments <args>, under <env>: the tasks
718
+ // `test:unit` of the crates the paths choose (every crate without a path) as Turborepo's, the
719
+ // exit code its.
466
720
  function tester(racine, tous, args, env) {
467
- const p = passe(racine, env);
468
721
  const chemins = args.filter(a => !a.startsWith('-'));
469
722
  const options = args.filter(a => a.startsWith('-') && a !== '--force');
470
- let choix;
471
- let m = null;
723
+ let choisis = tous;
472
724
  if (chemins.length) {
473
725
  const r = choisir(racine, tous, chemins);
474
726
  if (r.refus) {
@@ -477,17 +729,72 @@ function tester(racine, tous, args, env) {
477
729
  }
478
730
  return 2;
479
731
  }
480
- choix = r.choix;
481
- } else if (env[DEPUIS_LE_VERT]) {
482
- ({ choix, m } = depuisLeVert(racine, tous, args.includes('--force'), env));
483
- choix = choix.map(c => ({ c, cibles: [] }));
484
- } else {
485
- choix = tous.map(c => ({ c, cibles: [] }));
732
+ choisis = r.choix.map(x => x.c);
486
733
  }
487
- try {
488
- jouerLesTests(racine, p, choix, options);
489
- } finally {
490
- m?.retirer();
734
+ const { noms, absents } = nomsDuGraphe(racine, choisis);
735
+ if (chemins.length && absents.length) {
736
+ process.stderr.write(
737
+ `⛔ ${absents.join(', ')} : pas un paquet du graphe (package.json absent) : npx grillhouse maj\n`
738
+ );
739
+ return 2;
740
+ }
741
+ direLesAbsents(absents);
742
+ if (noms.size === 0) {
743
+ return 0;
744
+ }
745
+ return lancerLesTaches({
746
+ outil: OUTIL,
747
+ racine,
748
+ taches: [SCRIPT_DES_TESTS],
749
+ noms,
750
+ tests: testsCibles({
751
+ arguments: [...chemins.map(c => path.resolve(racine, c)), ...options],
752
+ force: args.includes('--force'),
753
+ }),
754
+ env,
755
+ });
756
+ }
757
+
758
+ // The pass of `tests-du-paquet` in <racine>, the crates <tous>, its arguments <args>, under <env>:
759
+ // the body of the task `test:unit` of a crate. The paths its script names, completed by those of
760
+ // the variable of the task that lie in the same crate.
761
+ function testsDuPaquet(racine, tous, args, env) {
762
+ const donnes = args.filter(a => !a.startsWith('-'));
763
+ if (donnes.length === 0) {
764
+ process.stderr.write(
765
+ '⛔ tests-du-paquet : aucun chemin (un dossier de crate, ou un fichier de test).\n'
766
+ );
767
+ return 2;
768
+ }
769
+ const dossierDe = abs =>
770
+ composantDans(
771
+ tous.map(x => x.composant),
772
+ racine,
773
+ abs
774
+ )?.dossier ?? null;
775
+ const { chemins, options } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
776
+ const r = choisir(racine, tous, chemins);
777
+ if (r.refus) {
778
+ for (const l of r.refus) {
779
+ process.stderr.write(`⛔ ${l}\n`);
780
+ }
781
+ return 2;
782
+ }
783
+ const p = passe(racine, env);
784
+ jouerLesTests(racine, p, r.choix, [...args.filter(a => a.startsWith('-')), ...options])();
785
+ return p.code();
786
+ }
787
+
788
+ // The pass of `tests-de-nuit` in <racine>, the crates <tous>, under <env>: the night tests and the
789
+ // benches of each crate that holds some, each named.
790
+ function testsDeNuit(racine, tous, env) {
791
+ const p = passe(racine, env);
792
+ const choix = tous
793
+ .filter(c => joueDesTests(racine, c.composant))
794
+ .map(c => ({ c, cibles: c.cibles.filter(horsDuJour).map(t => t.name) }))
795
+ .filter(x => x.cibles.length);
796
+ if (choix.length) {
797
+ jouerLesTests(racine, p, choix, [])();
491
798
  }
492
799
  return p.code();
493
800
  }