@roomi-fields/grillhouse 0.54.1 → 0.55.1

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 (236) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +69 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
  4. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
  5. package/cadre/templates/projet/CONTRIBUTING.md +0 -5
  6. package/cadre/templates/projet/README.md +0 -126
  7. package/cadre/templates/projet/_npmignore +1 -6
  8. package/cadre/templates/projet/package.json +5 -32
  9. package/cadre/templates/projet/tsconfig.json +4 -4
  10. package/cadre/templates/projet/vitest.config.cjs +3 -2
  11. package/charte/tests.md +14 -0
  12. package/dist/machine/part-par-sorte.d.ts +9 -9
  13. package/dist/machine/part-par-sorte.js +20 -24
  14. package/dist/machine/part-par-sorte.js.map +1 -1
  15. package/dist/machine/table-des-consommations.d.ts +65 -0
  16. package/dist/machine/table-des-consommations.js +94 -0
  17. package/dist/machine/table-des-consommations.js.map +1 -0
  18. package/dist/temporal/circuit/activites.d.ts +2 -0
  19. package/dist/temporal/circuit/activites.js +87 -3
  20. package/dist/temporal/circuit/activites.js.map +1 -1
  21. package/dist/temporal/circuit/client.js +9 -4
  22. package/dist/temporal/circuit/client.js.map +1 -1
  23. package/dist/temporal/circuit/contrat.d.ts +32 -4
  24. package/dist/temporal/circuit/deroule.js +54 -4
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/circuit/versions.d.ts +12 -0
  27. package/dist/temporal/circuit/versions.js +22 -0
  28. package/dist/temporal/circuit/versions.js.map +1 -0
  29. package/dist/temporal/consommation/activites.d.ts +2 -0
  30. package/dist/temporal/consommation/activites.js +9 -0
  31. package/dist/temporal/consommation/activites.js.map +1 -0
  32. package/dist/temporal/consommation/actualisation.d.ts +2 -0
  33. package/dist/temporal/consommation/actualisation.js +71 -0
  34. package/dist/temporal/consommation/actualisation.js.map +1 -0
  35. package/dist/temporal/consommation/client.d.ts +12 -0
  36. package/dist/temporal/consommation/client.js +28 -0
  37. package/dist/temporal/consommation/client.js.map +1 -0
  38. package/dist/temporal/consommation/commande.d.ts +5 -0
  39. package/dist/temporal/consommation/commande.js +32 -0
  40. package/dist/temporal/consommation/commande.js.map +1 -0
  41. package/dist/temporal/consommation/contrat.d.ts +15 -0
  42. package/dist/temporal/consommation/contrat.js +13 -0
  43. package/dist/temporal/consommation/contrat.js.map +1 -0
  44. package/dist/temporal/consommation/deroule.d.ts +2 -0
  45. package/dist/temporal/consommation/deroule.js +14 -0
  46. package/dist/temporal/consommation/deroule.js.map +1 -0
  47. package/dist/temporal/deroules.d.ts +2 -1
  48. package/dist/temporal/deroules.js +3 -2
  49. package/dist/temporal/deroules.js.map +1 -1
  50. package/dist/temporal/file/contrat.d.ts +2 -0
  51. package/dist/temporal/file/deroule.js +14 -4
  52. package/dist/temporal/file/deroule.js.map +1 -1
  53. package/dist/temporal/installation.d.ts +6 -0
  54. package/dist/temporal/installation.js +15 -0
  55. package/dist/temporal/installation.js.map +1 -1
  56. package/dist/temporal/nuits/activites.d.ts +2 -1
  57. package/dist/temporal/nuits/activites.js +127 -3
  58. package/dist/temporal/nuits/activites.js.map +1 -1
  59. package/dist/temporal/nuits/client.d.ts +19 -5
  60. package/dist/temporal/nuits/client.js +33 -23
  61. package/dist/temporal/nuits/client.js.map +1 -1
  62. package/dist/temporal/nuits/commande.js +16 -11
  63. package/dist/temporal/nuits/commande.js.map +1 -1
  64. package/dist/temporal/nuits/contrat.d.ts +29 -0
  65. package/dist/temporal/nuits/contrat.js +10 -0
  66. package/dist/temporal/nuits/contrat.js.map +1 -1
  67. package/dist/temporal/nuits/deroule.d.ts +5 -0
  68. package/dist/temporal/nuits/deroule.js +18 -1
  69. package/dist/temporal/nuits/deroule.js.map +1 -1
  70. package/dist/temporal/nuits/pc2.d.ts +72 -0
  71. package/dist/temporal/nuits/pc2.js +206 -0
  72. package/dist/temporal/nuits/pc2.js.map +1 -0
  73. package/dist/temporal/places/activites.d.ts +23 -1
  74. package/dist/temporal/places/activites.js +38 -2
  75. package/dist/temporal/places/activites.js.map +1 -1
  76. package/dist/temporal/places/client.d.ts +16 -0
  77. package/dist/temporal/places/client.js +25 -1
  78. package/dist/temporal/places/client.js.map +1 -1
  79. package/dist/temporal/places/contrat.d.ts +79 -14
  80. package/dist/temporal/places/contrat.js +7 -0
  81. package/dist/temporal/places/contrat.js.map +1 -1
  82. package/dist/temporal/places/deroule.js +159 -23
  83. package/dist/temporal/places/deroule.js.map +1 -1
  84. package/dist/temporal/places/reservation.d.ts +54 -0
  85. package/dist/temporal/places/reservation.js +69 -0
  86. package/dist/temporal/places/reservation.js.map +1 -0
  87. package/dist/temporal/planification.d.ts +6 -0
  88. package/dist/temporal/planification.js +26 -0
  89. package/dist/temporal/planification.js.map +1 -0
  90. package/dist/temporal/tickets/activites.d.ts +0 -2
  91. package/dist/temporal/tickets/activites.js +2 -52
  92. package/dist/temporal/tickets/activites.js.map +1 -1
  93. package/dist/temporal/tickets/contrat.d.ts +7 -26
  94. package/dist/temporal/tickets/deroule.js +35 -23
  95. package/dist/temporal/tickets/deroule.js.map +1 -1
  96. package/dist/temporal/travailleur.js +2 -0
  97. package/dist/temporal/travailleur.js.map +1 -1
  98. package/docs/ARCHITECTURE.md +2 -2
  99. package/docs/CADRE.md +1 -1
  100. package/docs/INTERFACE.md +16 -11
  101. package/docs/architecture/circuit.md +62 -58
  102. package/docs/architecture/entree.md +87 -63
  103. package/docs/architecture/greffon.md +24 -21
  104. package/docs/architecture/installation.md +35 -30
  105. package/docs/architecture/machine.md +48 -40
  106. package/docs/architecture/tests.md +37 -33
  107. package/docs/lexique.md +4 -3
  108. package/package.json +1 -1
  109. package/scripts/activites.mjs +351 -180
  110. package/scripts/aiguillage.mjs +1 -0
  111. package/scripts/attente-de-la-machine.mjs +3 -22
  112. package/scripts/avancement.mjs +21 -30
  113. package/scripts/bilan.mjs +22 -2
  114. package/scripts/branche-de-nuit.mjs +1 -1
  115. package/scripts/circuit.mjs +75 -39
  116. package/scripts/codes-de-sortie.mjs +0 -6
  117. package/scripts/consommation-des-passes.mjs +67 -31
  118. package/scripts/consommation.mjs +152 -24
  119. package/scripts/copies-finies.mjs +15 -35
  120. package/scripts/dernier-vert.mjs +4 -5
  121. package/scripts/dette.mjs +5 -3
  122. package/scripts/droits.mjs +2 -2
  123. package/scripts/echantillonneur-de-la-passe.mjs +7 -31
  124. package/scripts/engendres.mjs +5 -61
  125. package/scripts/enveloppe/enveloppe.mjs +30 -34
  126. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
  127. package/scripts/etapes.mjs +21 -7
  128. package/scripts/etat-du-depot.mjs +61 -0
  129. package/scripts/faits-du-circuit.mjs +7 -4
  130. package/scripts/fermeture-de-la-machine.d.mts +6 -4
  131. package/scripts/fermeture-de-la-machine.mjs +12 -16
  132. package/scripts/fichier-du-poste.d.mts +9 -0
  133. package/scripts/file-des-tickets.d.mts +0 -18
  134. package/scripts/file-des-tickets.mjs +0 -42
  135. package/scripts/fusion-du-changelog.mjs +1 -1
  136. package/scripts/grillhouse-maj.mjs +1 -1
  137. package/scripts/index-des-rouges.d.mts +40 -0
  138. package/scripts/index-des-rouges.mjs +104 -0
  139. package/scripts/integration/file.mjs +13 -63
  140. package/scripts/integration/integrer.mjs +157 -424
  141. package/scripts/integration/jugement.mjs +109 -0
  142. package/scripts/integration/rejeu.mjs +94 -71
  143. package/scripts/jointure.d.ts +34 -27
  144. package/scripts/journal-des-etats.d.mts +1 -1
  145. package/scripts/langages/c/commandes.mjs +27 -12
  146. package/scripts/langages/cargo/commandes.mjs +148 -94
  147. package/scripts/langages/cargo/index.mjs +2 -1
  148. package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
  149. package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
  150. package/scripts/langages/python/commandes.mjs +31 -15
  151. package/scripts/langages/python/index.mjs +2 -1
  152. package/scripts/langages/python/lectures-des-tests.mjs +148 -0
  153. package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
  154. package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
  155. package/scripts/langages/typescript/index.mjs +4 -0
  156. package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
  157. package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
  158. package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
  159. package/scripts/langages/typescript/tests.mjs +11 -37
  160. package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
  161. package/scripts/langages/typescript/verifier.mjs +74 -44
  162. package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
  163. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
  164. package/scripts/lectures-communes.mjs +234 -0
  165. package/scripts/machine.mjs +11 -18
  166. package/scripts/mesure/base-de-passe.mjs +1 -2
  167. package/scripts/mesure-de-la-machine.d.mts +40 -3
  168. package/scripts/mesure-de-la-machine.mjs +201 -11
  169. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
  170. package/scripts/migrations/nuit-yml-retire.mjs +25 -0
  171. package/scripts/migrations/part-retiree.mjs +31 -0
  172. package/scripts/migrations.mjs +4 -0
  173. package/scripts/montee.mjs +9 -0
  174. package/scripts/nuit-de-pc2.mjs +628 -0
  175. package/scripts/nuit.sh +8 -131
  176. package/scripts/paquets.mjs +1 -1
  177. package/scripts/passe-de-la-machine.mjs +340 -103
  178. package/scripts/place-du-circuit.d.mts +15 -0
  179. package/scripts/place-du-circuit.mjs +32 -0
  180. package/scripts/places-de-la-machine.mjs +148 -626
  181. package/scripts/places-du-serveur.mjs +26 -13
  182. package/scripts/plafond-de-la-machine.d.mts +8 -13
  183. package/scripts/plafond-de-la-machine.mjs +26 -56
  184. package/scripts/registre-des-entrees.mjs +57 -0
  185. package/scripts/regles-des-places.d.mts +82 -50
  186. package/scripts/regles-des-places.mjs +192 -156
  187. package/scripts/retirer-copie.sh +2 -2
  188. package/scripts/seances.mjs +181 -63
  189. package/scripts/secours.mjs +95 -0
  190. package/scripts/services-du-noyau.mjs +11 -19
  191. package/scripts/sous-commandes.mjs +1 -0
  192. package/scripts/sous-modules.sh +1 -1
  193. package/scripts/superviseur.mjs +16 -7
  194. package/scripts/table-des-consommations.d.mts +9 -0
  195. package/scripts/table-des-consommations.mjs +35 -0
  196. package/scripts/tableau.mjs +33 -19
  197. package/scripts/taches-du-graphe.mjs +124 -2
  198. package/scripts/transitions.d.mts +27 -5
  199. package/scripts/transitions.mjs +122 -104
  200. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  201. package/scripts/verdict-de-la-nuit.mjs +34 -7
  202. package/scripts/verrou-de-fichier.mjs +1 -2
  203. package/scripts/workflows-du-cadre.mjs +2 -2
  204. package/skills/developpeur/SKILL.md +8 -2
  205. package/skills/direct/SKILL.md +5 -0
  206. package/skills/explorateur/SKILL.md +10 -1
  207. package/skills/grill/SKILL.md +2 -4
  208. package/skills/pitmaster/SKILL.md +7 -5
  209. package/skills/pitmaster/references/consigne-agent.md +1 -1
  210. package/skills/relecteur/SKILL.md +4 -1
  211. package/skills/testwriter/SKILL.md +15 -2
  212. package/cadre/templates/projet/.env.example +0 -57
  213. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  214. package/cadre/templates/projet/deployment/README.md +0 -98
  215. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  216. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  217. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  218. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  219. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  220. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  221. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  222. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  223. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  224. package/cadre/templates/projet/src/config.ts +0 -68
  225. package/cadre/templates/projet/src/errors.ts +0 -102
  226. package/cadre/templates/projet/src/index.ts +0 -46
  227. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  228. package/cadre/templates/projet/src/types/index.ts +0 -24
  229. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  230. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  231. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  232. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  233. package/cadre/templates/projet/tsconfig.build.json +0 -14
  234. package/scripts/flux-de-la-nuit.mjs +0 -39
  235. package/scripts/garde-de-la-memoire.mjs +0 -231
  236. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -23,11 +23,11 @@
23
23
  // (`GRILLHOUSE_INDEX_DU_DEPOT`), which the guard tasks hash (./turbo-des-paquets.mjs).
24
24
  // - `--tout`, and `--force` (the night, scripts/nuit.sh), play the complete pass: each task of
25
25
  // tests for real (`GRILLHOUSE_TESTS` carries only `rejouer`, the moment of the pass, no path).
26
- // - The part of the budget of the machine (scripts/places-de-la-machine.mjs, `avecLaPasse`): a
27
- // pass whose part does not fit waits, says so with what it waits for, when it begins and every
28
- // 30 s; the wait bounded (60 min), it ends at 75; a key `grillhouse.part` or a reserve that is
29
- // faulty ends it at once, red (1); either way without playing. A pass in the frame's own
30
- // repository passes before a project's. It plays held to its part in a control group of its own.
26
+ // - The reservation of the arbiter of the machine (scripts/passe-de-la-machine.mjs, `avecLaPasse`):
27
+ // a pass whose reservation does not fit waits, says so with what it waits for, when it begins and
28
+ // every 30 s, in the order of arrival; the wait bounded (60 min), it ends at 75; a reserve that is
29
+ // faulty, or an arbiter that does not answer (named), ends it at once, red (1); either way without
30
+ // playing. It plays held to its reservation in a control group of its own.
31
31
  // - Turborepo plays the build, the guards (`grillhouse:gardes`, the project's `gardes`), the
32
32
  // typing (`typecheck`, ./turbo-des-paquets.mjs) and the tests (`test:unit`) beside each other:
33
33
  // `turbo run grillhouse:gardes gardes typecheck test:unit --continue=dependencies-successful
@@ -36,9 +36,8 @@
36
36
  // stops no task whose prerequisites passed, and each red is named. The workers of each task of
37
37
  // tests (`travailleursDeLaPasse`, GRILLHOUSE_TRAVAILLEURS) share the cores between the tasks of
38
38
  // tests side by side: the test processes of a pass never outnumber the cores.
39
- // - The memory watch (scripts/garde-de-la-memoire.mjs): the run is cut when the memory available
40
- // and the free swap run out, or when the machine waits for its memory half of the time; the
41
- // pass says why and ends at 75, no task judged.
39
+ // - The pass watches no memory: the arbiter does (src/temporal/places/deroule.ts), and the system
40
+ // cuts its group at the ceiling of its phase.
42
41
  // - The pass plays no measure of time: a time budget bench and a time witness (a test file that
43
42
  // imports `mesurerAuRepos`) are out of the day, as the night tests are (vitest-config/cibles.mjs,
44
43
  // ./tests-de-nuit.mjs). A delay past is a red, and so is a task at 75.
@@ -62,8 +61,7 @@
62
61
  // directory (`GRILLHOUSE_RESULTATS`) it goes there. A task at 0 is green; any other code, 75
63
62
  // included, and a summary that does not read while Turborepo failed: red, code 1, each task named.
64
63
  // - The progress (scripts/avancement.mjs): the directory `GRILLHOUSE_AVANCEMENT` names, else one
65
- // of its own, named in the file of the part it holds (`nommerLAvancement`) and removed at its
66
- // end. Before its run, the plan (`turbo run … --dry=json`) names the tasks of tests and counts
64
+ // of its own, removed at its end. Before its run, the plan (`turbo run … --dry=json`) names the tasks of tests and counts
67
65
  // done the files of those Turborepo replays from its cache.
68
66
  // - The red tasks: while `GRILLHOUSE_ROUGES` (`ROUGES`) names a file, the pass writes there, once
69
67
  // each, one line per task red on its own exit code: its id (`<package>#<task>`, `//#<task>`
@@ -81,32 +79,34 @@ import { availableParallelism, tmpdir } from 'node:os';
81
79
  import path from 'node:path';
82
80
  import { pathToFileURL } from 'node:url';
83
81
  import {
84
- A_REPASSER,
85
82
  AttenteDeLaMachine,
86
83
  AVANCEMENT,
87
84
  avecLaPasse,
88
85
  BASE_DU_LOT,
89
86
  CHANGEMENTS,
87
+ commenterLeTicket,
90
88
  consignerLesRegressions,
89
+ etatDuDepot,
91
90
  garderLeRegistre,
92
91
  garderLeTotal,
93
92
  garderLeVert,
94
- GARDE_DE_LA_MEMOIRE,
95
93
  LA_FORME,
96
94
  langageDe,
97
- MEMOIRE_COUPEE,
98
95
  lireLaTranche,
99
96
  lireLeRegistre,
97
+ lireLeTicket,
100
98
  mesure,
101
- nommerLAvancement,
102
99
  ouvrirAvancement,
103
100
  ouvrirBase,
104
101
  PASSE_ROUGE,
102
+ refusDuSecours,
105
103
  retirerALInterruption,
106
104
  SCRIPT_DES_TESTS,
107
105
  SCRIPTS_DE_GARDES as GARDES,
108
106
  tachesCoteACote as concurrence,
107
+ terminerLeSecours,
109
108
  TESTS_CIBLES,
109
+ passeComplete,
110
110
  testsCibles,
111
111
  travailleursDeLaSeance,
112
112
  VARIABLE_TRAVAILLEURS,
@@ -186,14 +186,12 @@ export function verifier({
186
186
  try {
187
187
  return avecLaPasse(
188
188
  (envMachine, { part }) => {
189
- // The cores the pass shares between its tasks: its part's, else its parent's part's.
189
+ // The cores the pass shares between its tasks: its reservation's, else its parent's.
190
190
  const sesCoeurs = part?.coeurs ?? travailleursDeLaSeance(envMachine) ?? coeurs;
191
- // The progress of the pass: the directory its caller names (the circuit's), else its own,
192
- // named in the file of its part while it plays.
191
+ // The progress of the pass: the directory its caller names (the circuit's), else its own.
193
192
  const propre = !envMachine[AVANCEMENT];
194
193
  const dossier =
195
194
  envMachine[AVANCEMENT] || ouvrirAvancement({ racine, genre: 'verification' });
196
- const effacer = propre ? nommerLAvancement({ env: envMachine, dossier }) : () => {};
197
195
  try {
198
196
  return passe({
199
197
  racine,
@@ -203,7 +201,6 @@ export function verifier({
203
201
  coeurs: sesCoeurs,
204
202
  });
205
203
  } finally {
206
- effacer();
207
204
  if (propre) {
208
205
  garderLeTotal(dossier);
209
206
  rmSync(dossier, { recursive: true, force: true });
@@ -246,13 +243,15 @@ const depotAvecTests = racine => paquetsAvecTests(racine) > 0;
246
243
  // Whether <args> hold a filter of Turborepo (`--filter=<f>`, `--filter <f>`, `-F <f>`).
247
244
  const filtre = args => args.some(a => a.startsWith('--filter=') || a === '--filter' || a === '-F');
248
245
 
249
- // A pass green on every package keeps its tree as the last green (`garder`): not when it is
250
- // restricted by a filter or to a part of its tasks (<partielle>: a tranche, `--sans-tests`),
246
+ // A pass green on every package keeps its tree as the last green (`garder`), and says it registers
247
+ // none (the line returned): not when it is restricted by a filter or to a part of its tasks (<partielle>: a tranche, `--sans-tests`),
251
248
  // measured against nothing, or run after a red module (PASSE_ROUGE).
252
249
  export function poserLeVert({ code, etat, args, env, garder, partielle = false }) {
253
250
  if (code === 0 && etat && !partielle && !filtre(args) && !env[PASSE_ROUGE]) {
254
251
  garder(etat);
252
+ return '↳ arbre non inscrit : la vérification garde son arbre comme dernier vert, sans le juger (seules la voie de secours, `--secours <ticket>`, et la montée inscrivent).';
255
253
  }
254
+ return undefined;
256
255
  }
257
256
 
258
257
  // The options of the pass in <demandes>: `{ gardesSeules, sansTests, tranche, tout, base, args,
@@ -265,9 +264,10 @@ export function poserLeVert({ code, etat, args, env, garder, partielle = false }
265
264
  export function lireLesDemandes(demandes) {
266
265
  const gardesSeules = demandes.includes('--gardes');
267
266
  const sansTests = demandes.includes('--sans-tests');
268
- const tout = demandes.includes('--tout') || demandes.includes('--force');
267
+ const tout = passeComplete(demandes);
269
268
  let base;
270
269
  let texte;
270
+ let secours;
271
271
  const args = [];
272
272
  for (let i = 0; i < demandes.length; i++) {
273
273
  const a = demandes[i];
@@ -280,6 +280,12 @@ export function lireLesDemandes(demandes) {
280
280
  i += texte ? 1 : 0;
281
281
  } else if (a.startsWith('--tranche=')) {
282
282
  texte = a.slice('--tranche='.length);
283
+ } else if (a === '--secours') {
284
+ const suite = demandes[i + 1];
285
+ secours = suite !== undefined && !suite.startsWith('-') ? suite : '';
286
+ i += secours ? 1 : 0;
287
+ } else if (a.startsWith('--secours=')) {
288
+ secours = a.slice('--secours='.length);
283
289
  } else if (a === '--base') {
284
290
  const suite = demandes[i + 1];
285
291
  if (suite !== undefined && !suite.startsWith('-')) {
@@ -298,6 +304,10 @@ export function lireLesDemandes(demandes) {
298
304
  let erreur;
299
305
  if (texte !== undefined && !tranche) {
300
306
  erreur = `⛔ --tranche attend la forme ${LA_FORME}, deux entiers avec 1 ≤ i ≤ n (par exemple --tranche 1/3) : « ${texte} » ne l'a pas.`;
307
+ } else if (secours === '') {
308
+ erreur = `⛔ --secours attend le ticket de la voie de secours (par exemple --secours grillhouse-x.1).`;
309
+ } else if (secours && (gardesSeules || sansTests || tranche)) {
310
+ erreur = `⛔ --secours inscrit l'arbre d'une vérification entière : il ne se combine ni avec --gardes, ni avec --sans-tests, ni avec --tranche.`;
301
311
  } else if (tranche && (gardesSeules || sansTests)) {
302
312
  erreur = `⛔ --tranche joue les seuls tests : elle ne se combine ni avec --gardes ni avec --sans-tests.`;
303
313
  }
@@ -306,7 +316,8 @@ export function lireLesDemandes(demandes) {
306
316
  gardesSeules,
307
317
  sansTests,
308
318
  tranche,
309
- tout,
319
+ tout: tout || Boolean(secours),
320
+ secours: secours || undefined,
310
321
  base: mesure ? base : undefined,
311
322
  args,
312
323
  ...(erreur ? { erreur } : {}),
@@ -352,7 +363,17 @@ export function testsDeLaTranche(tranche, racine) {
352
363
 
353
364
  function passe({ racine, demandes, env, dire, coeurs }) {
354
365
  const lu = lireLesDemandes(demandes);
355
- const { gardesSeules, sansTests, tranche, tout, base, args } = lu;
366
+ const { gardesSeules, sansTests, tranche, tout, base, args, secours } = lu;
367
+ // The rescue way: its ticket is read and judged before any work, and a refusal registers nothing.
368
+ let ticket = null;
369
+ if (secours) {
370
+ ticket = lireLeTicket(racine, secours);
371
+ const refus = ticket.erreur ?? refusDuSecours(ticket);
372
+ if (refus) {
373
+ dire(`⛔ --secours : ${refus} Arbre non inscrit, rien n'est joué.`);
374
+ return 1;
375
+ }
376
+ }
356
377
  // The measure against the last green, or the base given: a pass without tests needs none.
357
378
  const m =
358
379
  gardesSeules || sansTests
@@ -390,7 +411,7 @@ function passe({ racine, demandes, env, dire, coeurs }) {
390
411
  writeFileSync(env[ROUGES], [...taches].map(t => `${t}\t${rejeu(t)}\n`).join(''));
391
412
  }
392
413
  // A pass green on every package keeps its tree as the last green.
393
- poserLeVert({
414
+ const ligneDuVert = poserLeVert({
394
415
  code,
395
416
  etat: m?.etat,
396
417
  args,
@@ -398,6 +419,29 @@ function passe({ racine, demandes, env, dire, coeurs }) {
398
419
  garder: garderLeVert,
399
420
  partielle: Boolean(tranche) || sansTests,
400
421
  });
422
+ if (ligneDuVert) {
423
+ dire(ligneDuVert);
424
+ }
425
+ // The rescue way registers the tree measured at the entry of the pass, when it is still the
426
+ // tree of the working directory at its end (scripts/secours.mjs).
427
+ if (ticket) {
428
+ const fin = m?.etat ? etatDuDepot(racine).arbre : null;
429
+ const fini = m?.etat
430
+ ? terminerLeSecours({
431
+ racine,
432
+ ticket,
433
+ etat: m.etat,
434
+ fin,
435
+ code,
436
+ partielle: Boolean(tranche) || sansTests || filtre(args) || Boolean(env[PASSE_ROUGE]),
437
+ commenter: (id, texte) => commenterLeTicket(racine, id, texte),
438
+ })
439
+ : {
440
+ ligne:
441
+ '↳ arbre non inscrit : le dépôt n’a pas d’état git que la voie de secours puisse inscrire.',
442
+ };
443
+ dire(fini.ligne);
444
+ }
401
445
  // The registry of a complete pass whose caller named a results directory, from the reports of
402
446
  // every language: green, it keeps the passed tests of its branch; red on main's own branch (the
403
447
  // night, or a complete pass on main), it records as regressions the tests the registry held
@@ -474,25 +518,11 @@ function jouerLaPasse({ racine, demandes, args, tout, ajouts, env, dire, coeurs,
474
518
  const runs = path.join(racine, '.turbo', 'runs');
475
519
  const existait = existsSync(runs);
476
520
  const avant = new Set(lister(runs));
477
- // Under the watch of the memory, which writes in its witness why it cut the run.
478
- const temoin = path.join(e.TMPDIR || tmpdir(), `memoire-coupee-${process.pid}`);
479
- rmSync(temoin, { force: true });
480
- const r = spawnSync(
481
- process.execPath,
482
- [GARDE_DE_LA_MEMOIRE, '--temoin', temoin, '--', 'turbo', 'run', ...a, '--summarize'],
483
- { cwd: racine, env: e, stdio: 'inherit' }
484
- );
485
- if (existsSync(temoin)) {
486
- const raison = readFileSync(temoin, 'utf8').trim();
487
- rmSync(temoin, { force: true });
488
- garderLesResumes(racine, avant, e);
489
- // Said to whoever reads the results of the pass: its 75 is a cut, no wait of the machine.
490
- if (e[RESULTATS]) {
491
- writeFileSync(path.join(e[RESULTATS], MEMOIRE_COUPEE), `${raison}\n`);
492
- }
493
- dire(`⛔ ${raison}`);
494
- return A_REPASSER;
495
- }
521
+ const r = spawnSync('turbo', ['run', ...a, '--summarize'], {
522
+ cwd: racine,
523
+ env: e,
524
+ stdio: 'inherit',
525
+ });
496
526
  const nouveaux = lister(runs).filter(f => !avant.has(f) && f.endsWith('.json'));
497
527
  let resume = null;
498
528
  if (nouveaux.length === 1) {
@@ -45,9 +45,9 @@
45
45
  // `@roomi-fields/grillhouse/vitest-config/mesure`). `mergeConfig` adds the reporters and the setup files of
46
46
  // a configuration that extends this one to these; a reporter named on the command line
47
47
  // (`--reporter`) replaces them, and Vitest's code then stands.
48
- // - The machine of a test file is its own: a setup file gives it a directory of the state of the
49
- // parts of its own, so that a `npm run verifier` a test plays in a repository of trial takes its
50
- // part among its own parts alone (./machine.setup.mjs, scripts/places-de-la-machine.mjs).
48
+ // - The machine of a test file is a fixed one: a setup file names its measure, so that a pass a
49
+ // test plays in a repository of trial reads no load of the user's machine (./machine.setup.mjs,
50
+ // scripts/places-de-la-machine.mjs).
51
51
  // - While a run names its results directory (`GRILLHOUSE_RESULTATS`, ./resultats.mjs), the JSON
52
52
  // reporter writes Vitest's report there too, which the circuit reads (scripts/resultats.mjs); a
53
53
  // setup file gives each test file's processes a results directory of their own, so that a run a
@@ -1,30 +1,11 @@
1
- // A setup file of the base configuration: the machine of a test file is its own. The file gets a
2
- // directory of the state of the parts of its own (GRILLHOUSE_PARTS_DE_LA_MACHINE, a directory of
3
- // the temporary directory named after its process and a token, scripts/places-de-la-machine.mjs),
4
- // which every process it starts inherits: a `npm run verifier` or a circuit that a test plays in
5
- // a repository of trial takes its part there, among its own parts alone, and no test writes in the
6
- // user's state. A directory already named in the environment stays. The directory the file named
7
- // is removed at its end, with what a pass left there (the part of a pass a test killed, which
8
- // never gave it back), as the register of the file is (./registre.setup.mjs): the guard of the
9
- // temporary directory of the run finds nothing of it. Its passes want no room in
10
- // the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0) nor on the disk of their copy
11
- // (GRILLHOUSE_COPIE_LIBRE, 0): the room of the machine is the pass's that plays the file, which
12
- // waited for it.
1
+ // A setup file of the base configuration: the machine of a test file is a fixed one. Its passes
2
+ // want no room in the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0) nor on the disk of
3
+ // their copy (GRILLHOUSE_COPIE_LIBRE, 0): the room of the machine is the pass's that plays the
4
+ // file, which waited for it.
13
5
  //
14
- // That trial machine takes no place of the user's machine (scripts/places-de-la-machine.mjs): only
15
- // the server of trial a test names (GRILLHOUSE_PLACES_D_ESSAI).
6
+ // That trial machine asks no reservation of the user's arbiter (scripts/places-de-la-machine.mjs):
7
+ // only the server of trial a test names (GRILLHOUSE_PLACES_D_ESSAI).
16
8
  // Mechanism: packages/grillhouse/docs/architecture/tests.md, §3.3, §4.2.
17
- import { randomUUID } from 'node:crypto';
18
- import { rmSync } from 'node:fs';
19
- import { tmpdir } from 'node:os';
20
- import path from 'node:path';
21
- import { afterAll } from 'vitest';
22
-
23
- if (!process.env.GRILLHOUSE_PARTS_DE_LA_MACHINE) {
24
- const parts = path.join(tmpdir(), `grillhouse-parts-${process.pid}-${randomUUID()}`);
25
- process.env.GRILLHOUSE_PARTS_DE_LA_MACHINE = parts;
26
- afterAll(() => rmSync(parts, { recursive: true, force: true }));
27
- }
28
9
  // The machine a test reads is a fixed one (GRILLHOUSE_MESURE_D_ESSAI, scripts/places-de-la-machine.mjs
29
10
  // `etatDesPlaces`): no test reads the real load or memory of the user's machine.
30
11
  process.env.GRILLHOUSE_MESURE_D_ESSAI ||= JSON.stringify({
@@ -0,0 +1,234 @@
1
+ // What the guards `lectures-des-tests` of the modules of language share (scripts/langages/<module>/
2
+ // lectures-des-tests.mjs; packages/grillhouse/docs/architecture/tests.md §3.4): a test that reads
3
+ // the content of a document or of a source file of the repository by a path it writes whole
4
+ // detects a change of text, not a behaviour (« Change-Detector Tests Considered Harmful »). Each
5
+ // module reads its language's calls and expressions of path; this file judges the file they
6
+ // resolve to, the label that allows the reading and the finding.
7
+ //
8
+ // - A file read is a finding when it exists in the repository and is a document (`.md`) or a file
9
+ // of code (`.ts`, `.mjs`, `.js`, `.rs`, `.py`, `.sh`); a template of the project's `templates/`, a
10
+ // reference the project's `grillhouse.engendres` generates, and a file under node_modules are
11
+ // not.
12
+ // - The label `@lit-source: <raison>` in the head comment of the test allows its readings; a label
13
+ // without a reason is refused, as the reading it was to allow.
14
+ import { readFileSync, statSync } from 'node:fs';
15
+ import path from 'node:path';
16
+ import { couvertPar } from './paquets.mjs';
17
+
18
+ const REGLE = 'lecture-de-document-ou-de-code';
19
+ const ETIQUETTE = '@lit-source:';
20
+
21
+ const LU = /\.(?:md|ts|mjs|js|rs|py|sh)$/;
22
+ const TETE = /^(?:\s*(?:\/\/|#|\/\*|\*)[^\n]*\n|\s*\n)*/;
23
+
24
+ /** The label of the head comment of <texte>: 'permise' (with its reason), 'sans-raison', or null. */
25
+ function etiquette(texte) {
26
+ const tete = texte.match(TETE)?.[0] ?? '';
27
+ const m = tete.match(/@lit-source:([ \t]*)(\S[^\n]*)?/);
28
+ if (!m) {
29
+ return null;
30
+ }
31
+ return m[2]?.replace(/\*\/\s*$/, '').trim() ? 'permise' : 'sans-raison';
32
+ }
33
+
34
+ // The generated references of the project at <racine>, from the root (`grillhouse.engendres`).
35
+ function engendres(racine) {
36
+ try {
37
+ const e = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8'))?.grillhouse
38
+ ?.engendres;
39
+ return Object.values(e ?? {}).flatMap(x => (Array.isArray(x?.fichiers) ? x.fichiers : []));
40
+ } catch {
41
+ return [];
42
+ }
43
+ }
44
+
45
+ /**
46
+ * The file of the repository at <racine> that the path <valeur> names, read by the test <test> (from
47
+ * the root): resolved from the root, from the directory of the test, then from each directory
48
+ * above it. Returns its path from the root when it is a document or a file of code the guard
49
+ * judges, null when it does not exist, is a data, a manifest, a template or a generated reference.
50
+ */
51
+ function fichierLu(racine, test, valeur, memo = { engendres: null }) {
52
+ if (typeof valeur !== 'string' || valeur === '') {
53
+ return null;
54
+ }
55
+ const dossiers = [racine];
56
+ for (
57
+ let d = path.join(racine, path.dirname(test));
58
+ d.startsWith(racine) && d !== racine;
59
+ d = path.dirname(d)
60
+ ) {
61
+ dossiers.push(d);
62
+ }
63
+ for (const d of dossiers) {
64
+ const abs = path.resolve(d, valeur);
65
+ const rel = path.relative(racine, abs).split(path.sep).join('/');
66
+ if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) {
67
+ continue;
68
+ }
69
+ if (!statSync(abs, { throwIfNoEntry: false })?.isFile()) {
70
+ continue;
71
+ }
72
+ if (!LU.test(rel) || /(?:^|\/)(?:templates|node_modules)\//.test(rel)) {
73
+ return null;
74
+ }
75
+ memo.engendres ??= engendres(racine);
76
+ return couvertPar(memo.engendres, rel) ? null : rel;
77
+ }
78
+ return null;
79
+ }
80
+
81
+ /** The finding of the test <test> that reads <lu>. */
82
+ function constat(test, lu) {
83
+ return {
84
+ fichier: test,
85
+ regle: REGLE,
86
+ message: `${test} : lit le contenu de ${lu}, un document ou un fichier de code du dépôt ; un test prouve un comportement par son interface, et une lecture de texte se casse à la reformulation sans rien prouver (« Change-Detector Tests Considered Harmful »). Le test importe l'interface publiée ; une lecture voulue porte en tête ${ETIQUETTE} <raison>.`,
87
+ };
88
+ }
89
+
90
+ /** The finding of the test <test> whose label carries no reason. */
91
+ function constatSansRaison(test, lu) {
92
+ return {
93
+ ...constat(test, lu),
94
+ message: `${test} : l'étiquette ${ETIQUETTE} n'a pas de raison, et lit ${lu} ; elle s'écrit ${ETIQUETTE} <raison>.`,
95
+ };
96
+ }
97
+
98
+ /**
99
+ * The findings of the tests <tests> (from the root) of <racine>, one per test: <lectures> gives the
100
+ * files (from the root) a test's text reads, by its language's reading.
101
+ */
102
+ export function constatsDes(racine, tests, lectures) {
103
+ const memo = { engendres: null };
104
+ return tests.flatMap(test => {
105
+ let texte;
106
+ try {
107
+ texte = readFileSync(path.join(racine, test), 'utf8');
108
+ } catch {
109
+ return [];
110
+ }
111
+ const lus = lectures(texte, test, v => fichierLu(racine, test, v, memo));
112
+ const premier = lus.find(Boolean);
113
+ if (!premier) {
114
+ return [];
115
+ }
116
+ const e = etiquette(texte);
117
+ if (e === 'permise') {
118
+ return [];
119
+ }
120
+ return [e === 'sans-raison' ? constatSansRaison(test, premier) : constat(test, premier)];
121
+ });
122
+ }
123
+
124
+ /**
125
+ * <texte> without its comments (`//` and `/* *\/` when <bloc>, `#` when <diese>), a quoted string
126
+ * kept whole.
127
+ */
128
+ function sansCommentaires(texte, { bloc = false, diese = false } = {}) {
129
+ let out = '';
130
+ for (let i = 0; i < texte.length; i++) {
131
+ const c = texte[i];
132
+ if (c === '"' || (c === "'" && diese)) {
133
+ const j = finDeChaine(texte, i);
134
+ out += texte.slice(i, j + 1);
135
+ i = j;
136
+ } else if (!diese && c === '/' && texte[i + 1] === '/') {
137
+ while (i < texte.length && texte[i] !== '\n') {
138
+ i++;
139
+ }
140
+ out += '\n';
141
+ } else if (bloc && c === '/' && texte[i + 1] === '*') {
142
+ const fin = texte.indexOf('*/', i + 2);
143
+ i = fin < 0 ? texte.length : fin + 1;
144
+ out += ' ';
145
+ } else if (diese && c === '#') {
146
+ while (i < texte.length && texte[i] !== '\n') {
147
+ i++;
148
+ }
149
+ out += '\n';
150
+ } else {
151
+ out += c;
152
+ }
153
+ }
154
+ return out;
155
+ }
156
+
157
+ /** The arguments of the call whose `(` is at <ouvrante> in <texte>, split at the top level. */
158
+ function arguments_(texte, ouvrante) {
159
+ const out = [];
160
+ let profondeur = 0;
161
+ let debut = ouvrante + 1;
162
+ for (let i = ouvrante; i < texte.length; i++) {
163
+ const c = texte[i];
164
+ if (c === '"' || c === "'" || c === '`') {
165
+ i = finDeChaine(texte, i);
166
+ } else if (c === '(' || c === '[' || c === '{') {
167
+ profondeur++;
168
+ } else if (c === ')' || c === ']' || c === '}') {
169
+ profondeur--;
170
+ if (profondeur === 0) {
171
+ const a = texte.slice(debut, i).trim();
172
+ if (a) {
173
+ out.push(a);
174
+ }
175
+ return out;
176
+ }
177
+ } else if (c === ',' && profondeur === 1) {
178
+ out.push(texte.slice(debut, i).trim());
179
+ debut = i + 1;
180
+ }
181
+ }
182
+ return out;
183
+ }
184
+
185
+ // The index of the quote that ends the string opened at <i>.
186
+ function finDeChaine(texte, i) {
187
+ const q = texte[i];
188
+ let j = i + 1;
189
+ while (j < texte.length && texte[j] !== q && (q === '`' || texte[j] !== '\n')) {
190
+ j += texte[j] === '\\' ? 2 : 1;
191
+ }
192
+ return j;
193
+ }
194
+
195
+ /** The text of <s> if it is one string literal (quotes of `'`, `"`, a template without a substitution), else null. */
196
+ function litteral(s) {
197
+ const m = s.match(/^(['"`])((?:\\.|(?!\1)[^\\])*)\1$/s);
198
+ return m && !(m[1] === '`' && m[2].includes('${')) ? m[2] : null;
199
+ }
200
+
201
+ /** <s> up to its first `;` or end of line at the top level, from <debut>. */
202
+ function expressionDepuis(texte, debut) {
203
+ let profondeur = 0;
204
+ for (let i = debut; i < texte.length; i++) {
205
+ const c = texte[i];
206
+ if (c === '"' || c === "'" || c === '`') {
207
+ i = finDeChaine(texte, i);
208
+ } else if (c === '(' || c === '[' || c === '{') {
209
+ profondeur++;
210
+ } else if (c === ')' || c === ']' || c === '}') {
211
+ profondeur--;
212
+ } else if ((c === ';' || c === '\n') && profondeur <= 0) {
213
+ return texte.slice(debut, i).trim();
214
+ }
215
+ }
216
+ return texte.slice(debut).trim();
217
+ }
218
+
219
+ /** Joins the resolved parts of a path, null when one is unresolved. */
220
+ function joindre(parts) {
221
+ if (parts.some(p => p === null || p === undefined)) {
222
+ return null;
223
+ }
224
+ return parts.reduce((a, b) => (a === null ? b : path.posix.join(a, b)), null);
225
+ }
226
+
227
+ /** The reading of an expression of path, which each module of language applies to its own syntax. */
228
+ export const analyse = {
229
+ argumentsDuAppel: arguments_,
230
+ expressionDepuis,
231
+ joindre,
232
+ litteral,
233
+ sansCommentaires,
234
+ };
@@ -14,26 +14,19 @@
14
14
  import path from 'node:path';
15
15
  import { setTimeout as dormirVraiment } from 'node:timers/promises';
16
16
  import { direLaFermeture } from './fermeture-de-la-machine.mjs';
17
- import {
18
- dossierDesParts,
19
- fermerLaMachine,
20
- lireLesParts,
21
- lirePlaces,
22
- rouvrirLaMachine,
23
- } from './places-de-la-machine.mjs';
17
+ import { fermerLaMachine, lirePlaces, rouvrirLaMachine } from './places-de-la-machine.mjs';
24
18
 
25
19
  const SONDE_MS = 2_000;
26
20
 
27
21
  /**
28
- * What the machine holds now: the sessions (places) and the passes (parts that hold their part),
29
- * and the reservation in place.
22
+ * What the machine holds now, as the arbiter's view gives it: the reservations granted (steps of the
23
+ * circuits and passes), and the closure in place. <lues> is the view, `lirePlaces` by default.
30
24
  * @param {Record<string, string | undefined>} env
25
+ * @param {{ lues?: ReturnType<typeof lirePlaces> }} [o]
31
26
  */
32
- export function lireLaMachine(env = process.env) {
33
- const lues = lirePlaces({ env });
27
+ export function lireLaMachine(env = process.env, { lues = lirePlaces({ env }) } = {}) {
34
28
  return {
35
29
  prises: lues.prises ?? [],
36
- parts: lireLesParts(dossierDesParts(env)).prises,
37
30
  fermeture: lues.fermeture ?? null,
38
31
  };
39
32
  }
@@ -69,11 +62,11 @@ export async function jouer(
69
62
  }
70
63
  const issue = agir(mode, { env });
71
64
  const dit = () => {
72
- const { prises, parts, fermeture } = lire(env);
73
- for (const l of direLaFermeture({ issue, reservation: fermeture, prises, parts, maintenant: maintenant() })) {
65
+ const { prises, fermeture } = lire(env);
66
+ for (const l of direLaFermeture({ issue, reservation: fermeture, prises, maintenant: maintenant() })) {
74
67
  dire(l);
75
68
  }
76
- return prises.length + parts.length;
69
+ return prises.length;
77
70
  };
78
71
  const restent = dit();
79
72
  if (!attendre) {
@@ -82,12 +75,12 @@ export async function jouer(
82
75
  let encore = restent;
83
76
  while (encore > 0) {
84
77
  await dormir(SONDE_MS);
85
- const { prises, parts } = lire(env);
86
- if (prises.length + parts.length === 0) {
78
+ const { prises } = lire(env);
79
+ if (prises.length === 0) {
87
80
  dire('la machine est vide');
88
81
  return 0;
89
82
  }
90
- encore = prises.length + parts.length;
83
+ encore = prises.length;
91
84
  }
92
85
  return 0;
93
86
  }
@@ -14,8 +14,7 @@
14
14
  // `npm run verifier` (scripts/langages/typescript/verifier.mjs), whose base Turborepo passes to its tasks
15
15
  // (`globalPassThroughEnv`, scripts/langages/typescript/turbo-des-paquets.mjs); `circuit`, the results and progress
16
16
  // of the passes of a circuit's run (scripts/circuit.mjs; its working directory is the ticket's,
17
- // beside its copy, which no sweep touches); `integration`, the working directory of an
18
- // integration (scripts/integration/integrer.mjs); `file`, the results of the final pass of the queue
17
+ // beside its copy, which no sweep touches); `file`, the results of the final pass of the queue
19
18
  // (scripts/integration/file.mjs); `enveloppe`, the throwaway state of a session's envelope
20
19
  // (scripts/enveloppe/enveloppe.mjs); `seance`, the temporary directory of one session of an
21
20
  // agent that the frame launches, opened by the launcher of the envelope