@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
@@ -1,12 +1,13 @@
1
1
  // A test that measures time marks itself, so that its failure under load is « à repasser », not a
2
- // red (./duree.reporter.mjs):
2
+ // red (./duree.reporter.mjs), and its file, a time witness, plays at night alone, out of the day
3
+ // (./cibles.mjs, grillhouse-bd7):
3
4
  //
4
5
  // import { mesurerAuRepos } from '@roomi-fields/grillhouse/vitest-config/mesure';
5
6
  // it('rend en moins de 50 ms', ctx => mesurerAuRepos(ctx, () => { … expect(ms).toBeLessThan(50); }));
6
7
  //
7
8
  // `mesurerAuRepos(ctx, fn)` marks the test of the context <ctx> as a measure of time and gives back
8
9
  // what <fn> returns (a promise as it is, for the test to await). A time budget bench
9
- // (`*.budget.test.*`) and a delay past need no mark.
10
+ // (`*.budget.test.*`) needs no mark, nor a delay past in a night test.
10
11
  export function mesurerAuRepos(ctx, fn) {
11
12
  ctx.task.meta.mesureDeTemps = true;
12
13
  return fn();
@@ -1,19 +1,25 @@
1
- // The night tests of a project: the files `*.nuit.test.*` and `*.nuit.spec.*`, too long for the
2
- // day, and its time budget benches (`*.budget.test.*`, `*.budget.spec.*`), whose measures move with
3
- // the load of the day; `npm test`, `npm run verifier` and the integration leave them out (the
4
- // frame's base configuration of the day, the package @roomi-fields/grillhouse/vitest-config, which every day
5
- // configuration extends, excludes both). The night (scripts/nuit.sh, by ./tests-de-nuit.mjs) plays them with this
6
- // configuration, from the root of its copy (`vitest run --root <copy> --config <this file>`),
7
- // after a green full pass (`npm run verifier -- --force`) and before the project's night script.
8
- // It reads no day configuration of the project, whether the project has one at its root or one
9
- // per package; it takes from the base configuration the common environment (git's settings) and
10
- // the measure of time: the setup file that notes the CPU pressure of each test and the duration
11
- // reporter, which gives 75, « à repasser », to a bench that fails under load
12
- // (scripts/langages/typescript/vitest-config/duree.reporter.mjs).
1
+ // What the day leaves out of a project: the night tests (`*.nuit.test.*`, `*.nuit.spec.*`), too
2
+ // long for the day, and the measures of time, the time budget benches (`*.budget.test.*`,
3
+ // `*.budget.spec.*`) and the time witnesses (a test file that imports `mesurerAuRepos`), whose
4
+ // measures move with the load of the day (grillhouse-bd7); `npm test`, `npm run verifier` and the
5
+ // integration leave them out (the frame's base configuration of the day, the package
6
+ // @roomi-fields/grillhouse/vitest-config, which every day configuration extends). The night
7
+ // (scripts/nuit.sh, by ./tests-de-nuit.mjs) plays them with this configuration, from the root of
8
+ // its copy (`vitest run --root <copy> --config <this file>`), after a green full pass (`npm run
9
+ // verifier -- --force`) and before the project's night script: its include names the night tests
10
+ // and the benches, and its plugin adds the witnesses under the root, or chooses the night tests
11
+ // alone or the measures alone, one file at a time (`nuit` of ./vitest-config/cibles.mjs, the
12
+ // variable GRILLHOUSE_TESTS_DE_NUIT). It reads no day configuration of the project, whether the
13
+ // project has one at its root or one per package; it takes from the base configuration the common
14
+ // environment (git's settings) and the measure of time: the setup file that notes the CPU pressure
15
+ // of each test and the duration reporter, which gives 75, « à repasser », to a measure that fails
16
+ // under load (scripts/langages/typescript/vitest-config/duree.reporter.mjs).
13
17
  import base from './vitest-config/base.mjs';
14
- import { HORS_DU_JOUR } from './vitest-config/cibles.mjs';
18
+ import { HORS_DU_JOUR, nuit } from './vitest-config/cibles.mjs';
19
+ import { DELAI_NUIT_MS } from './vitest-config/bornes.mjs';
15
20
 
16
21
  export default {
22
+ plugins: [nuit()],
17
23
  test: {
18
24
  env: base.test.env,
19
25
  environment: base.test.environment,
@@ -21,6 +27,9 @@ export default {
21
27
  setupFiles: base.test.setupFiles,
22
28
  include: HORS_DU_JOUR,
23
29
  exclude: ['**/node_modules/**', '**/dist/**', '**/.git/**'],
30
+ // The large delay of Bazel for a night test: 900 s (./vitest-config/delais.mjs).
31
+ testTimeout: DELAI_NUIT_MS,
32
+ hookTimeout: DELAI_NUIT_MS,
24
33
  watch: false,
25
34
  },
26
35
  };
@@ -0,0 +1,51 @@
1
+ // The readings done once in a scope, as a build of Bazel reads each file once whatever the number
2
+ // of targets that ask it: inside `avecUneLecture`, a reading kept under its key (`luUneFois`) is
3
+ // done at its first call and given again after; out of any scope, it is done at each call. A
4
+ // scope is the time of one gesture of the core that asks a module many questions on a tree that
5
+ // does not move (the sweep of the siblings of HEAD's version, scripts/circuit.mjs); a module of
6
+ // language keeps there what it reads at a cost (cargo's metadata). A reading that throws is not
7
+ // kept. The scope lives on the process under a global symbol, so that every instance of this file
8
+ // shares it: the modules of language are loaded by `require` (./langages.mjs), which a test
9
+ // runner may load apart from the core's imports.
10
+
11
+ const PORTEE = Symbol.for('grillhouse.lecture-unique');
12
+
13
+ /** @returns {Map<string, unknown> | undefined} */
14
+ const portee = () => /** @type {any} */ (globalThis)[PORTEE];
15
+
16
+ /**
17
+ * Runs <faire> in a scope of readings done once, and returns what it returns; inside a scope
18
+ * already open, in that one.
19
+ * @template T
20
+ * @param {() => T} faire
21
+ * @returns {T}
22
+ */
23
+ export function avecUneLecture(faire) {
24
+ if (portee()) {
25
+ return faire();
26
+ }
27
+ /** @type {any} */ (globalThis)[PORTEE] = new Map();
28
+ try {
29
+ return faire();
30
+ } finally {
31
+ delete (/** @type {any} */ (globalThis)[PORTEE]);
32
+ }
33
+ }
34
+
35
+ /**
36
+ * What <lire> returns, read once under <cle> in the scope open, at each call out of any.
37
+ * @template T
38
+ * @param {string} cle
39
+ * @param {() => T} lire
40
+ * @returns {T}
41
+ */
42
+ export function luUneFois(cle, lire) {
43
+ const p = portee();
44
+ if (!p) {
45
+ return lire();
46
+ }
47
+ if (!p.has(cle)) {
48
+ p.set(cle, lire());
49
+ }
50
+ return /** @type {T} */ (p.get(cle));
51
+ }
@@ -1,7 +1,8 @@
1
- // The CPU pressure of the machine, the witness of rest for every measure of time: a time witness
2
- // is measured with the CPU at rest, and a failure that depends on a duration under load is played
3
- // again at rest (« à repasser »), never taken as a red nor as a green. The model is Bazel's
4
- // TIMEOUT/FLAKY and CTest's `--repeat after-timeout`: classify, then play again.
1
+ // The CPU pressure of the machine, the witness of rest for every measure of time, which plays at
2
+ // night (grillhouse-bd7): a measure is taken with the CPU at rest, and a failure that depends on a
3
+ // duration under load is played again at rest (« à repasser »), never taken as a red nor as a
4
+ // green. The model is Bazel's TIMEOUT/FLAKY and CTest's `--repeat after-timeout`: classify, then
5
+ // play again.
5
6
  //
6
7
  // - The signal is the kernel's pressure stall information, `/proc/pressure/cpu`, line `some`,
7
8
  // field `avg10`: the share of the last ten seconds in which a task waited for a CPU, in %.
@@ -9,10 +10,11 @@
9
10
  // - The machine is at rest under SEUIL_PRESSION (25 %); at or above it, it is under load.
10
11
  // - A file that does not read (no pressure stall information on the machine) gives null: whoever
11
12
  // reads it says « pression illisible » and leaves the verdict to the runner of the tests.
12
- // - A_REPASSER, 75, is the exit code of « à repasser » (EX_TEMPFAIL of sysexits.h: try again
13
- // later), neither green nor red: the duration reporter of the module of the language gives it
14
- // (scripts/langages/typescript/vitest-config/duree.reporter.mjs), `npm run verifier` reads it (scripts/langages/typescript/verifier.mjs),
15
- // and so do the integration, the queue and the night.
13
+ // - A_REPASSER (scripts/codes-de-sortie.mjs), 75, is the exit code of « à repasser » (EX_TEMPFAIL
14
+ // of sysexits.h: try again later), neither green nor red: the measure of time of each module of language gives it
15
+ // (scripts/langages/typescript/vitest-config/duree.reporter.mjs, the benches of the module cargo),
16
+ // and the night reads it (scripts/nuit.sh). The day waits for no rest: `npm run verifier` takes a
17
+ // task at 75 for a red (scripts/langages/typescript/verifier.mjs).
16
18
  //
17
19
  // npx grillhouse pression attendre
18
20
  //
@@ -20,9 +22,9 @@
20
22
  // waits so before it plays its time budget benches again (scripts/nuit.sh).
21
23
  import { readFileSync } from 'node:fs';
22
24
  import { pathToFileURL } from 'node:url';
25
+ import { A_REPASSER } from '../codes-de-sortie.mjs';
23
26
 
24
27
  export const SEUIL_PRESSION = 25;
25
- export const A_REPASSER = 75;
26
28
  export const FICHIER_PRESSION = '/proc/pressure/cpu';
27
29
  // The longest wait for rest, and the shortest gap between two lines that say it waits.
28
30
  export const BORNE_ATTENTE_MS = 15 * 60_000;
@@ -0,0 +1,21 @@
1
+ // The types of the measure of the machine (./mesure-de-la-machine.mjs), which the activity of the workflow of
2
+ // the machine under Temporal (src/temporal/places/activites.ts) imports.
3
+ import type { MesureDeLaMachine } from './regles-des-places.mjs';
4
+
5
+ /** The memory available now, in bytes. */
6
+ export function memoireDisponible(): number;
7
+
8
+ /** The machine now: its cores, its load over one minute, its free memory in bytes. */
9
+ export function mesureDeLaMachine(): MesureDeLaMachine;
10
+
11
+ /** The start of the process <pid> as the system gives it, null when it is gone. */
12
+ export function departDe(pid: number): string | null;
13
+
14
+ /** Whether the process <pid> lives and is the one of its start <depart>. */
15
+ export function processusVivant(p: { pid: number; depart: string | null }): boolean;
16
+
17
+ /** <signal> to the process group <groupe>; false when the group is gone. */
18
+ export function signalerGroupe(groupe: number | null | undefined, signal: NodeJS.Signals | 0): boolean;
19
+
20
+ /** Whether the group a sign of life <vie> names still runs, its leader dead or alive. */
21
+ export function groupeVivant(vie: { pid: number; depart?: string | null } | null | undefined): boolean;
@@ -0,0 +1,76 @@
1
+ // What the machine gives at a moment, which the admission of a start reads
2
+ // (scripts/regles-des-places.mjs): its cores, its load over one minute, its free memory. The
3
+ // activity of the workflow of the machine (src/temporal/places/activites.ts) measures it here, and
4
+ // whether the process of a place still lives; a signal to a process group, and whether the group
5
+ // a sign of life names still runs, which the sessions (scripts/seances.mjs), the circuit and the
6
+ // acts under Temporal (src/temporal/acte.ts) share.
7
+ import { readFileSync } from 'node:fs';
8
+ import { availableParallelism, freemem, loadavg } from 'node:os';
9
+ import { departDe, leMemeVivant, vivant } from './mesure/base-de-passe.mjs';
10
+
11
+ export { departDe };
12
+
13
+ /**
14
+ * The memory available now, in bytes (MemAvailable of the kernel, else the free memory of node).
15
+ * @returns {number}
16
+ */
17
+ export function memoireDisponible() {
18
+ try {
19
+ const kio = /^MemAvailable:\s+(\d+) kB/m.exec(readFileSync('/proc/meminfo', 'utf8'))?.[1];
20
+ if (kio) {
21
+ return Number(kio) * 1024;
22
+ }
23
+ } catch {
24
+ // no /proc/meminfo: the free memory of node
25
+ }
26
+ return freemem();
27
+ }
28
+
29
+ /**
30
+ * The machine now: `{ coeurs, charge, memoireLibre }`, the load over one minute, the memory in bytes.
31
+ * @returns {{ coeurs: number, charge: number, memoireLibre: number }}
32
+ */
33
+ export const mesureDeLaMachine = () => ({
34
+ coeurs: availableParallelism(),
35
+ charge: loadavg()[0],
36
+ memoireLibre: memoireDisponible(),
37
+ });
38
+
39
+ /**
40
+ * Whether the process <pid> lives and is the one of its start <depart> (`departDe`; any process
41
+ * of that number without a start): a place whose process is gone is free.
42
+ * @param {{ pid: number, depart: string | null }} p
43
+ * @returns {boolean}
44
+ */
45
+ export const processusVivant = ({ pid, depart }) =>
46
+ depart ? leMemeVivant(pid, depart) : vivant(pid);
47
+
48
+ /**
49
+ * <signal> to the process group <groupe>; false when the group is gone (or not the caller's).
50
+ * @param {number | null | undefined} groupe
51
+ * @param {NodeJS.Signals | 0} signal
52
+ * @returns {boolean}
53
+ */
54
+ export function signalerGroupe(groupe, signal) {
55
+ if (!groupe) {
56
+ return false;
57
+ }
58
+ try {
59
+ process.kill(-groupe, signal);
60
+ return true;
61
+ } catch {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Whether the group a sign of life <vie> names still runs: its group answers, and its leader, when
68
+ * it lives, is the process of its start (a number reused names another); a group whose leader died
69
+ * runs as long as one of its processes does.
70
+ * @param {{ pid: number, depart?: string | null } | null | undefined} vie
71
+ * @returns {boolean}
72
+ */
73
+ export const groupeVivant = vie =>
74
+ Boolean(vie?.pid) &&
75
+ signalerGroupe(vie.pid, 0) &&
76
+ (!vie.depart || !vivant(vie.pid) || leMemeVivant(vie.pid, vie.depart));
@@ -80,9 +80,15 @@ function formesAnterieures(texte) {
80
80
  const hacher = octets => createHash('sha256').update(octets).digest('hex');
81
81
  const lireJson = f => JSON.parse(readFileSync(f, 'utf8'));
82
82
 
83
- // The subcommand that runs each script of the package, by the path of its former copy.
83
+ // The subcommand that runs each script of the package, by the path of its former copy; a former
84
+ // copy whose subcommand runs another script since (`circuit`, the client of the workflow of a
85
+ // ticket since 0.30.0, src/temporal/circuit/commande.ts) keeps its subcommand.
86
+ const DEPLACEES = [['scripts/circuit.mjs', 'circuit']];
84
87
  const parCopie = projet =>
85
- new Map(Object.entries(scriptsDesSousCommandes(projet)).map(([n, s]) => [`scripts/${s}`, n]));
88
+ new Map([
89
+ ...Object.entries(scriptsDesSousCommandes(projet)).map(([n, s]) => [`scripts/${s}`, n]),
90
+ ...DEPLACEES,
91
+ ]);
86
92
 
87
93
  // The lines of the list that keep a path: a file, or a directory « …/ ».
88
94
  const gardees = texte =>
@@ -0,0 +1,120 @@
1
+ // From 0.30.0 `npm run verifier` plays the format check and the lint beside the guards, the typing
2
+ // and the tests, and the CI calls it alone (grillhouse-61z): a control played in the CI is played
3
+ // at the poste.
4
+ //
5
+ // - The `.github/workflows/ci.yml` of the project that is identical, spaces normalized, to the
6
+ // template of the version before is replaced by the new template.
7
+ // - One that differs (a step the project added) stays, and `aFaire` names the steps to remove from
8
+ // its test job: `format:check`, `lint`, `typecheck` and `build`.
9
+ // - One that already calls the verification alone, and a project without CI, are left, nothing
10
+ // said: a second pass changes nothing.
11
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
12
+ import path from 'node:path';
13
+ import { CADRE } from '../cadre.mjs';
14
+
15
+ export const version = '0.30.0';
16
+ export const nom = 'ci appelle la vérification';
17
+
18
+ const CI = '.github/workflows/ci.yml';
19
+ const GABARIT = path.join(CADRE, 'templates', 'projet');
20
+
21
+ // The template of 0.29.0, the version before this one.
22
+ const D_AVANT = `name: CI
23
+
24
+ on:
25
+ push:
26
+ branches: [main, develop]
27
+ pull_request:
28
+ branches: [main, develop]
29
+
30
+ jobs:
31
+ test:
32
+ runs-on: ubuntu-latest
33
+
34
+ strategy:
35
+ matrix:
36
+ node-version: [22.x, 24.x]
37
+
38
+ steps:
39
+ - name: Checkout
40
+ uses: actions/checkout@v5
41
+
42
+ - name: Setup Node.js \${{ matrix.node-version }}
43
+ uses: actions/setup-node@v5
44
+ with:
45
+ node-version: \${{ matrix.node-version }}
46
+ cache: 'npm'
47
+
48
+ - name: Install dependencies
49
+ run: npm ci
50
+
51
+ - name: Check formatting
52
+ run: npm run format:check
53
+
54
+ - name: Lint
55
+ run: npm run lint
56
+
57
+ - name: Typecheck
58
+ run: npm run typecheck
59
+
60
+ - name: Build
61
+ run: npm run build --if-present
62
+
63
+ - name: Guards and tests
64
+ run: npm run verifier
65
+
66
+ build:
67
+ runs-on: ubuntu-latest
68
+ needs: test
69
+
70
+ steps:
71
+ - name: Checkout
72
+ uses: actions/checkout@v5
73
+
74
+ - name: Setup Node.js
75
+ uses: actions/setup-node@v5
76
+ with:
77
+ node-version: '22'
78
+ cache: 'npm'
79
+
80
+ - name: Install dependencies
81
+ run: npm ci
82
+
83
+ - name: Build
84
+ run: npm run build --if-present
85
+
86
+ - name: Check package
87
+ run: npm pack --dry-run
88
+ `;
89
+
90
+ // The versions before of the template (each one's text, to compare with the project's).
91
+ const ANCIENNES = [D_AVANT];
92
+
93
+ // A text with its blanks normalized: line ends, trailing spaces, runs of blanks.
94
+ const normaliser = t =>
95
+ t
96
+ .split(/\r?\n/)
97
+ .map(l => l.trim().replace(/[ \t]+/g, ' '))
98
+ .filter(l => l !== '')
99
+ .join('\n');
100
+
101
+ /** Replaces the CI of the project by the template's when it is a former one; returns what it did. */
102
+ export function migrer(projet) {
103
+ const f = path.join(projet, CI);
104
+ if (!existsSync(f)) return [];
105
+ const actuel = normaliser(readFileSync(f, 'utf8'));
106
+ const neuf = readFileSync(path.join(GABARIT, CI), 'utf8');
107
+ if (actuel === normaliser(neuf)) return [];
108
+ if (ANCIENNES.some(a => normaliser(a) === actuel)) {
109
+ writeFileSync(f, neuf);
110
+ return [`${CI} : remplacé par celui du gabarit, qui n'appelle que \`npm run verifier\``];
111
+ }
112
+ if (!/^\s*run:\s*npm run (format:check|lint|typecheck|build)\b/m.test(readFileSync(f, 'utf8'))) {
113
+ return [];
114
+ }
115
+ return [
116
+ {
117
+ aFaire: `${CI} : \`npm run verifier\` joue la mise en forme, le lint, le typage et la construction ; retirer du job de test les étapes \`format:check\`, \`lint\`, \`typecheck\` et \`build\`, et ne garder après l'installation que \`npm run verifier\`.`,
118
+ },
119
+ ];
120
+ }
@@ -0,0 +1,81 @@
1
+ // From 0.31.0 every package enters the graph of Turborepo by a `package.json` beside its manifest
2
+ // (grillhouse-44b.4, node_modules/turbo/docs/guides/multi-language.mdx:191): the crate and the
3
+ // project of Python of an existing project, which `grillhouse paquet` did not create, receive the
4
+ // same one.
5
+ //
6
+ // - The packages are those the column « Langage » of the tables of the components of
7
+ // docs/ARCHITECTURE.md declares `cargo` or `python`, and whose folder holds the manifest of their
8
+ // language with a package name (a `Cargo.toml` of a virtual workspace names none), the root
9
+ // excluded; a folder is named by its path, its name or its manifest's name, as the guard of the
10
+ // languages reads a component. A package of another language receives nothing.
11
+ // - The package.json of a package is the one the command writes (./paquet-npm.mjs): the manifest's
12
+ // name, `private`, the scripts `build`, `test:unit` and `typecheck`. A package.json present is
13
+ // kept as it is when its name is the manifest's; any other is left to the project (`aFaire`,
14
+ // both names), as is a name another package of the workspaces bears, and nothing else is written
15
+ // for that package.
16
+ // - The folder of each package is entered in the `workspaces` of the root package.json when its
17
+ // patterns do not select it, after the pattern `!` that takes it out.
18
+ // - A project already migrated, or without crate nor project of Python, is not written: a second
19
+ // pass changes nothing and returns no line.
20
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
21
+ import path from 'node:path';
22
+ import {
23
+ inscrireAuxEspaces,
24
+ packageJsonDuPaquet,
25
+ paquetsSansPackageJson,
26
+ } from '../paquet-npm.mjs';
27
+ import { paquets } from '../paquets.mjs';
28
+
29
+ export const version = '0.31.0';
30
+ export const nom = 'paquets dans le graphe';
31
+
32
+ export function migrer(projet) {
33
+ const racinePj = path.join(projet, 'package.json');
34
+ if (!existsSync(racinePj)) return [];
35
+ const lignes = [];
36
+ const inscrire = [];
37
+ for (const { chemin, nom: nomNpm } of paquetsSansPackageJson(projet)) {
38
+ const f = `${chemin}/package.json`;
39
+ const abs = path.join(projet, f);
40
+ if (existsSync(abs)) {
41
+ let present;
42
+ try {
43
+ present = JSON.parse(readFileSync(abs, 'utf8')).name;
44
+ } catch (e) {
45
+ lignes.push({ aFaire: `${f} : ${e.message} ; le nom du paquet est ${JSON.stringify(nomNpm)}.` });
46
+ continue;
47
+ }
48
+ if (present !== nomNpm) {
49
+ lignes.push({
50
+ aFaire: `${f} : son nom est ${JSON.stringify(present)}, celui de son manifeste ${JSON.stringify(nomNpm)} ; accorde-les, le paquet entre alors aux workspaces.`,
51
+ });
52
+ continue;
53
+ }
54
+ } else {
55
+ const autre = paquets(projet).find(p => p.pkg.name === nomNpm && p.dossier !== chemin);
56
+ if (autre) {
57
+ lignes.push({
58
+ aFaire: `${f} : le nom ${JSON.stringify(nomNpm)} est déjà celui de ${autre.dossier}/package.json ; un nom ne désigne qu'un paquet, renomme l'un des deux.`,
59
+ });
60
+ continue;
61
+ }
62
+ writeFileSync(abs, packageJsonDuPaquet(nomNpm, chemin));
63
+ lignes.push(`${f} : écrit, le paquet entre dans le graphe de Turborepo`);
64
+ }
65
+ inscrire.push(chemin);
66
+ }
67
+ let texte = readFileSync(racinePj, 'utf8');
68
+ const inscrits = [];
69
+ for (const chemin of inscrire) {
70
+ const neuf = inscrireAuxEspaces(texte, chemin);
71
+ if (neuf !== null) {
72
+ texte = neuf;
73
+ inscrits.push(chemin);
74
+ }
75
+ }
76
+ if (inscrits.length) {
77
+ writeFileSync(racinePj, texte);
78
+ lignes.push(`package.json : workspaces, ${inscrits.join(', ')} ajouté(s)`);
79
+ }
80
+ return lignes;
81
+ }
@@ -33,6 +33,9 @@ import * as triDesDecouvertes from './migrations/0.24.12-tri-des-decouvertes.mjs
33
33
  import * as scriptDesTests from './migrations/0.25.0-script-des-tests.mjs';
34
34
  import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
35
35
 
36
+ import * as ciAppelleLaVerification from './migrations/0.30.0-ci-appelle-la-verification.mjs';
37
+ import * as paquetsDansLeGraphe from './migrations/0.31.0-paquets-dans-le-graphe.mjs';
38
+
36
39
  /** The migrations of the core. */
37
40
  export const MIGRATIONS = [
38
41
  crochetsDeSeance,
@@ -44,6 +47,8 @@ export const MIGRATIONS = [
44
47
  triDesDecouvertes,
45
48
  scriptDesTests,
46
49
  langagesDansLArchitecture,
50
+ ciAppelleLaVerification,
51
+ paquetsDansLeGraphe,
47
52
  ];
48
53
 
49
54
  /**
package/scripts/nuit.sh CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # The night: once a day, the full pass played for real, then what the day never plays: the night
3
- # tests and the time budget benches. During the day `npm run verifier` (the integration's) plays
3
+ # tests and the measures of time (the time budget benches and the time witnesses). During the day `npm run verifier` (the integration's) plays
4
4
  # what the changes since the last green touch (scripts/integration/integrer.mjs,
5
5
  # scripts/dernier-vert.mjs); the module of the project's language plays each step
6
6
  # (scripts/jointure.d.ts).
@@ -23,8 +23,9 @@
23
23
  # becomes the last green of the day's passes.
24
24
  # Its three steps (the full pass, the night tests, the project's night script) each play even
25
25
  # when one before is red, as a CI plays its independent jobs; the night is red when one of them
26
- # is. A full pass « à repasser » (75: a failure of duration under load, which found no rest in
27
- # its bound) ends the night there, « à repasser », below.
26
+ # is. A full pass « à repasser » (75: the wait for the machine reached its bound; the pass plays
27
+ # no measure of time, and a delay past is a red there) ends the night there, « à repasser »,
28
+ # below.
28
29
  # An existing copy that does not get ready (its move onto HEAD, its cleaning or the setting of
29
30
  # its submodules fails) is removed by `scripts/retirer-copie.sh --jetable` (local work does not
30
31
  # hold it, a lock does) and created again, once; a copy that does not get ready the second time
@@ -38,10 +39,13 @@
38
39
  # (scripts/outils-cles.mjs) gives each command of the project its variables, each set to its
39
40
  # path, whatever the environment of the night's launcher; a faulty key turns the night red, the
40
41
  # log naming it, and nothing runs.
41
- # - The night tests: after the full pass, the night tests and the time budget benches, which
42
- # `npm test` and the integration leave out, played by the command `tests-de-nuit` of the module
43
- # of the copy's language (the module typescript's: the files `*.nuit.test.*`, `*.nuit.spec.*`,
44
- # `*.budget.test.*` and `*.budget.spec.*`, by Vitest), when the project declares a language
42
+ # - The night tests: after the full pass, the night tests, then the measures of time alone (the
43
+ # time budget benches and the time witnesses), which `npm test` and the integration leave out
44
+ # (grillhouse-bd7), played by the command `tests-de-nuit` of the module of the copy's language
45
+ # (the module typescript's: the files `*.nuit.test.*` and `*.nuit.spec.*`, then the files
46
+ # `*.budget.test.*`, `*.budget.spec.*` and those that import `mesurerAuRepos`, one at a time, by
47
+ # Vitest; the module python's, `*_nuit_test.py`; the module cargo's, the test targets
48
+ # `tests/*_nuit.rs` then the benches `tests/*_budget.rs`, by nextest), when the project declares a language
45
49
  # whose module describes it (scripts/commande-du-langage.mjs); none otherwise. A red turns the night red, with a log line that
46
50
  # says so, and the project's night script still plays. A run « à repasser » (75: every failure
47
51
  # depended on a duration, one under load) waits for rest (`npx grillhouse pression attendre`,
@@ -69,14 +73,17 @@
69
73
  # the commit accepts the push.
70
74
  # - The copies whose content is on main: once its steps are played, whatever their verdict, the
71
75
  # night passes each copy `git worktree list` names, the main tree and its own left out, through
72
- # scripts/retirer-copie.sh without `--jetable` (scripts/copies-finies.mjs), as a CI cleans its
76
+ # scripts/retirer-copie.sh without `--jetable` (scripts/retirer-les-copies-finies.mjs), as a CI cleans its
73
77
  # workspaces at the end of a pipeline: a copy whose commits and local work have all entered
74
78
  # main by their content goes, and its branch (main and a branch another copy holds stay); a copy
75
79
  # refused (commits or work not entered, a lock) or held by a running circuit (its ticket in progress, its
76
80
  # `<copie>.travail`, the lock of the integration or of the queue) stays, its log line naming
77
81
  # why and the place it holds, a kept copy whose ticket is closed losing what the tools of its
78
- # languages wrote there. The removal never changes the night's verdict; the end of each
79
- # circuit runs it too (scripts/circuit.mjs).
82
+ # languages wrote there. The night names its own copy to the removal, its steps played: the copy
83
+ # stays, and loses what the tools of its languages wrote there (`target`, `.turbo`), its
84
+ # `node_modules` kept, which its next preparation would remove anyway (grillhouse-k5y). The
85
+ # removal never changes the night's verdict; the end of each circuit runs it too
86
+ # (scripts/circuit.mjs), the night's copy untouched.
80
87
  # - It takes no lock of the integration or of the queue (scripts/integration/file.mjs): an
81
88
  # integration and the queue run during the night, each in its own copy.
82
89
  # - Its log is <git common dir>/nuit/<date>.log. Green: HEAD becomes the last green commit
@@ -219,6 +226,13 @@ jouer() {
219
226
  return 1
220
227
  fi
221
228
  eval "$outils"
229
+ # The data of the project (donnees-cles.mjs), exported the same way.
230
+ local donnees
231
+ if ! donnees=$(node "$ici/donnees-cles.mjs" "$copie"); then
232
+ echo "✗ la clé grillhouse.donnees est refusée : rien n'est joué."
233
+ return 1
234
+ fi
235
+ eval "$donnees"
222
236
  if [ -f "$copie/package-lock.json" ] && ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"; then
223
237
  monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
224
238
  cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
@@ -226,10 +240,10 @@ jouer() {
226
240
  # The full pass, played for real: the night replays no log of the cache. Each step plays even
227
241
  # when one before it is red; a step à repasser ends the night there, red if a step before it is.
228
242
  local code tache avant
229
- GRILLHOUSE_ROUGES="$rouges" monter npm --prefix "$copie" run verifier -- --force
243
+ GRILLHOUSE_ROUGES="$rouges" GRILLHOUSE_VERIFICATION_SORTE=Nuit monter npm --prefix "$copie" run verifier -- --force
230
244
  code=$?
231
245
  if [ "$code" -eq 75 ]; then
232
- echo "⏱ la passe complète est à repasser (code 75) : un échec de durée sous charge, sans repos dans la borne."
246
+ echo "⏱ la passe complète est à repasser (code 75) : l'attente de la machine a atteint sa borne."
233
247
  return 75
234
248
  fi
235
249
  if [ "$code" -ne 0 ]; then
@@ -287,9 +301,9 @@ fin() {
287
301
  }
288
302
  jouer >> "$journal" 2>&1
289
303
  verdict=$?
290
- # The copies whose content is on main go once the steps are played, the night's own kept; their
291
- # removal never changes the verdict.
292
- (cd "$racine" && node "$ici/copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
304
+ # The copies whose content is on main go once the steps are played, the night's own kept and
305
+ # pruned of its tools' outputs; their removal never changes the verdict.
306
+ (cd "$racine" && node "$ici/retirer-les-copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
293
307
 
294
308
  if [ "$verdict" -eq 75 ]; then
295
309
  echo "⏱ à repasser : ${tete:0:7} n'est ni vert ni rouge, la machine est restée chargée ; le dernier vert reste, aucun ticket, la nuit suivante rejoue." >> "$journal"