@roomi-fields/grillhouse 0.54.0 → 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 (237) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +75 -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 +32 -27
  104. package/docs/architecture/installation.md +43 -32
  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/greffons.mjs +282 -17
  137. package/scripts/grillhouse-maj.mjs +1 -1
  138. package/scripts/index-des-rouges.d.mts +40 -0
  139. package/scripts/index-des-rouges.mjs +104 -0
  140. package/scripts/integration/file.mjs +13 -63
  141. package/scripts/integration/integrer.mjs +157 -424
  142. package/scripts/integration/jugement.mjs +109 -0
  143. package/scripts/integration/rejeu.mjs +94 -71
  144. package/scripts/jointure.d.ts +34 -27
  145. package/scripts/journal-des-etats.d.mts +1 -1
  146. package/scripts/langages/c/commandes.mjs +27 -12
  147. package/scripts/langages/cargo/commandes.mjs +148 -94
  148. package/scripts/langages/cargo/index.mjs +2 -1
  149. package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
  150. package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
  151. package/scripts/langages/python/commandes.mjs +31 -15
  152. package/scripts/langages/python/index.mjs +2 -1
  153. package/scripts/langages/python/lectures-des-tests.mjs +148 -0
  154. package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
  155. package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
  156. package/scripts/langages/typescript/index.mjs +4 -0
  157. package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
  158. package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
  159. package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
  160. package/scripts/langages/typescript/tests.mjs +11 -37
  161. package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
  162. package/scripts/langages/typescript/verifier.mjs +74 -44
  163. package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
  164. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
  165. package/scripts/lectures-communes.mjs +234 -0
  166. package/scripts/machine.mjs +11 -18
  167. package/scripts/mesure/base-de-passe.mjs +1 -2
  168. package/scripts/mesure-de-la-machine.d.mts +40 -3
  169. package/scripts/mesure-de-la-machine.mjs +201 -11
  170. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
  171. package/scripts/migrations/nuit-yml-retire.mjs +25 -0
  172. package/scripts/migrations/part-retiree.mjs +31 -0
  173. package/scripts/migrations.mjs +4 -0
  174. package/scripts/montee.mjs +22 -1
  175. package/scripts/nuit-de-pc2.mjs +628 -0
  176. package/scripts/nuit.sh +8 -131
  177. package/scripts/paquets.mjs +1 -1
  178. package/scripts/passe-de-la-machine.mjs +340 -103
  179. package/scripts/place-du-circuit.d.mts +15 -0
  180. package/scripts/place-du-circuit.mjs +32 -0
  181. package/scripts/places-de-la-machine.mjs +148 -626
  182. package/scripts/places-du-serveur.mjs +26 -13
  183. package/scripts/plafond-de-la-machine.d.mts +8 -13
  184. package/scripts/plafond-de-la-machine.mjs +26 -56
  185. package/scripts/registre-des-entrees.mjs +57 -0
  186. package/scripts/regles-des-places.d.mts +82 -50
  187. package/scripts/regles-des-places.mjs +192 -156
  188. package/scripts/retirer-copie.sh +9 -2
  189. package/scripts/seances.mjs +181 -63
  190. package/scripts/secours.mjs +95 -0
  191. package/scripts/services-du-noyau.mjs +11 -19
  192. package/scripts/sous-commandes.mjs +1 -0
  193. package/scripts/sous-modules.sh +1 -1
  194. package/scripts/superviseur.mjs +98 -20
  195. package/scripts/table-des-consommations.d.mts +9 -0
  196. package/scripts/table-des-consommations.mjs +35 -0
  197. package/scripts/tableau.mjs +33 -19
  198. package/scripts/taches-du-graphe.mjs +124 -2
  199. package/scripts/transitions.d.mts +27 -5
  200. package/scripts/transitions.mjs +122 -104
  201. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  202. package/scripts/verdict-de-la-nuit.mjs +34 -7
  203. package/scripts/verrou-de-fichier.mjs +1 -2
  204. package/scripts/workflows-du-cadre.mjs +2 -2
  205. package/skills/developpeur/SKILL.md +8 -2
  206. package/skills/direct/SKILL.md +5 -0
  207. package/skills/explorateur/SKILL.md +10 -1
  208. package/skills/grill/SKILL.md +2 -4
  209. package/skills/pitmaster/SKILL.md +14 -7
  210. package/skills/pitmaster/references/consigne-agent.md +1 -1
  211. package/skills/relecteur/SKILL.md +4 -1
  212. package/skills/testwriter/SKILL.md +15 -2
  213. package/cadre/templates/projet/.env.example +0 -57
  214. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  215. package/cadre/templates/projet/deployment/README.md +0 -98
  216. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  217. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  218. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  219. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  220. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  221. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  222. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  223. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  224. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  225. package/cadre/templates/projet/src/config.ts +0 -68
  226. package/cadre/templates/projet/src/errors.ts +0 -102
  227. package/cadre/templates/projet/src/index.ts +0 -46
  228. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  229. package/cadre/templates/projet/src/types/index.ts +0 -24
  230. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  231. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  232. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  233. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  234. package/cadre/templates/projet/tsconfig.build.json +0 -14
  235. package/scripts/flux-de-la-nuit.mjs +0 -39
  236. package/scripts/garde-de-la-memoire.mjs +0 -231
  237. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -0,0 +1,109 @@
1
+ // The judgement the queue asks when main moved (docs/architecture/entree.md §3.1 « Acte de
2
+ // jugement »): the pass of the final pass (4.1), `npm run verifier` on the lot laid on the tip of
3
+ // main, played in the copy of the queue and read as the checks of the circuit read theirs.
4
+ import { spawnSync } from 'node:child_process';
5
+ import { mkdtempSync } from 'node:fs';
6
+ import path from 'node:path';
7
+ import { A_REPASSER } from '../codes-de-sortie.mjs';
8
+ import { BASE_DU_LOT } from '../dernier-vert.mjs';
9
+ import { ouvrirBase } from '../mesure/base-de-passe.mjs';
10
+ import { RESULTATS } from '../resultats.mjs';
11
+ import { garderLArbreJuge } from '../arbres-juges.mjs';
12
+ import { phaseDeLaPasse } from '../etapes.mjs';
13
+ import { VARIABLE_PHASE_DE_VERIFICATION } from '../places-de-la-machine.mjs';
14
+
15
+ // The journal of the ticket <ticket> in the main tree <racine>, the one its circuit writes
16
+ // (scripts/circuit.mjs).
17
+ export const journalDuTicket = (racine, ticket) =>
18
+ path.join(racine, '.claude', 'worktrees', `${ticket}.log`);
19
+
20
+ /**
21
+ * The act of judgement, the one act 4.1 and the queue both call (entree.md §2 rule 2): `npm run
22
+ * verifier` played in the copy <copie>, on the commit it holds, against the base <base> (the tip
23
+ * of main the lot lies on, `GRILLHOUSE_BASE_DU_LOT`) and in the phase <phase>, its results under
24
+ * <dossier> (`GRILLHOUSE_RESULTATS`). The caller keeps what is its own around the call: <lancer>
25
+ * (`(env) => { status }`) plays the command in its own envelope (the part of the machine and the
26
+ * control group of 4.1, the plain spawn of the queue). A red pass (neither 0 nor 75) has its reds
27
+ * read by <rouges> (`{ copie, dossier, code, ticket, journal }` → lines), when given; a green pass
28
+ * keeps its tree <arbre> as judged in <racine> (scripts/arbres-juges.mjs), when given.
29
+ * `{ code, rouges }`.
30
+ */
31
+ export function jugerLArbre({
32
+ lancer,
33
+ copie,
34
+ dossier,
35
+ base,
36
+ phase,
37
+ rouges,
38
+ ticket,
39
+ journal,
40
+ racine,
41
+ arbre,
42
+ }) {
43
+ const r = lancer(environnementDuJugement({ dossier, base, phase }));
44
+ const code = r.status ?? 1;
45
+ if (code === 0 && arbre) {
46
+ garderLArbreJuge(racine, arbre);
47
+ }
48
+ const rouge = code !== 0 && code !== A_REPASSER;
49
+ return {
50
+ code,
51
+ resultat: r,
52
+ rouges: rouge && rouges ? rouges({ copie, dossier, code, ticket, journal }) : [],
53
+ };
54
+ }
55
+
56
+ /** The variables the act of judgement sets on its pass: its results directory, its phase, its base. */
57
+ export function environnementDuJugement({ dossier, base, phase }) {
58
+ return {
59
+ [RESULTATS]: dossier,
60
+ [VARIABLE_PHASE_DE_VERIFICATION]: phase,
61
+ ...(base ? { [BASE_DU_LOT]: base } : {}),
62
+ };
63
+ }
64
+
65
+ /**
66
+ * The judgement the queue asks when main moved: the act `jugerLArbre` in the queue's own copy
67
+ * (`.claude/worktrees/file`, made ready on the commit by <ouvrir>, detached, its dependencies in
68
+ * agreement with the lock file) against the tip of main, in a base of its own (`ouvrirBase('file')`)
69
+ * swept by the next pass when the act was killed. `{ code, sortie, rouges, refus? }`; a copy that
70
+ * does not open plays no pass: 75, its refusal as the output, `refus` true. The tree is kept
71
+ * judged by the queue (`jugerLeCandidat`), which enters it.
72
+ */
73
+ export function jugementDeLaFile(racine, principale, dire, { rouges, ouvrir }) {
74
+ return ({ commit, ticket }) => {
75
+ const copie = path.join(racine, '.claude', 'worktrees', 'file');
76
+ const ouverte = ouvrir({ racine, copie, ref: commit, dire });
77
+ if (ouverte.refus) {
78
+ return { code: A_REPASSER, sortie: ouverte.refus, rouges: [], refus: true };
79
+ }
80
+ const base = spawnSync('git', ['-C', racine, 'rev-parse', `refs/heads/${principale}`], {
81
+ encoding: 'utf8',
82
+ }).stdout.trim();
83
+ const laBase = ouvrirBase('file');
84
+ try {
85
+ const dossier = mkdtempSync(path.join(laBase.dossier, 'resultats-'));
86
+ const j = jugerLArbre({
87
+ copie,
88
+ dossier,
89
+ base,
90
+ phase: phaseDeLaPasse({ etape: 'file' }),
91
+ rouges,
92
+ ticket,
93
+ journal: journalDuTicket(racine, ticket),
94
+ lancer: env => {
95
+ const r = spawnSync('bash', ouverte.monter('npm', 'run', 'verifier'), {
96
+ cwd: copie,
97
+ encoding: 'utf8',
98
+ maxBuffer: 256 * 1024 * 1024,
99
+ env: { ...process.env, ...env },
100
+ });
101
+ return { status: r.status, sortie: `${r.stdout ?? ''}${r.stderr ?? ''}` };
102
+ },
103
+ });
104
+ return { code: j.code, sortie: j.resultat.sortie, rouges: j.rouges };
105
+ } finally {
106
+ laBase.fermer();
107
+ }
108
+ };
109
+ }
@@ -1,9 +1,11 @@
1
- // The clean copy a lot is replayed in (packages/grillhouse/docs/architecture/entree.md §3.1
2
- // « La copie de la file », §4.1, §5.1), shared by the integration (scripts/integration/integrer.mjs,
3
- // a lot on the main of the moment) and the queue (scripts/integration/file.mjs, a branch replaced
4
- // on the main of the moment): the copy made ready and the project's commands. Neither verifies
5
- // there: the final pass (`jugerLeCandidat`, scripts/integration/file.mjs) judges the lot laid on
6
- // the tip of main, before main moves forward, not the CI of a branch.
1
+ // The clean copy the queue replays a branch in (packages/grillhouse/docs/architecture/entree.md §3.1
2
+ // « La copie de la file », §4.1, §5.1; scripts/integration/file.mjs, a branch replaced on the main
3
+ // of the moment): the copy made ready and the project's commands. It verifies nothing there: the
4
+ // final pass (`jugerLeCandidat`, scripts/integration/file.mjs) judges the lot laid on the tip of
5
+ // main, before main moves forward, not the CI of a branch. The commands of a copy and the install of
6
+ // its dependencies (`monterDans`, `accorderLesDependances`) serve the copy of a ticket too, where
7
+ // the final pass of the circuit commits its lot (scripts/activites.mjs) and the integration writes
8
+ // its final message (scripts/integration/integrer.mjs).
7
9
  //
8
10
  // - `ouvrirCopie` makes the copy <copie> ready on <ref>: detached, every untracked file removed, its
9
11
  // submodules set (`scripts/sous-modules.sh`, a local modification overwritten; a submodule the
@@ -28,12 +30,19 @@
28
30
  // changes the lock file or a manifest is installed as the continuous integration installs it
29
31
  // (`npm ci` refuses a lock file in disagreement with its manifest).
30
32
  // - Every command of the project run in the copy (`lancer`: the install) leaves the
31
- // index of its copy up to date, green or red: the consumers that apply a lot with `--index` (the
32
- // integration, the queue) read an index that matches the files the command touched, and none
33
- // refreshes for its own account.
33
+ // index of its copy up to date, green or red: the queue, which applies a lot with `--index`,
34
+ // reads an index that matches the files the command touched, and does not refresh for its own
35
+ // account.
34
36
  import { spawnSync } from 'node:child_process';
35
37
  import { createHash } from 'node:crypto';
36
- import { existsSync, lstatSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
38
+ import {
39
+ existsSync,
40
+ lstatSync,
41
+ mkdirSync,
42
+ readFileSync,
43
+ unlinkSync,
44
+ writeFileSync,
45
+ } from 'node:fs';
37
46
  import path from 'node:path';
38
47
  import { fileURLToPath } from 'node:url';
39
48
 
@@ -48,9 +57,10 @@ const SORTIE_MAX = 256 * 1024 * 1024;
48
57
  // The fingerprint of what `npm ci` reads in <copie>: the lock file at <verrou> and every
49
58
  // `package.json` git tracks (the root's and each workspace's, whatever pattern declares it: a
50
59
  // manifest too many costs one more `npm ci`, a manifest missed lets a disagreement pass).
51
- // `dansCopie` is git in the copy.
52
- function empreinteDesDependances(copie, verrou, dansCopie) {
53
- const suivis = dansCopie('ls-files', '-z', '--', ':(glob)**/package.json')
60
+ function empreinteDesDependances(copie, verrou) {
61
+ const suivis = spawnSync('git', ['-C', copie, 'ls-files', '-z', '--', ':(glob)**/package.json'], {
62
+ encoding: 'utf8',
63
+ })
54
64
  .stdout.split('\0')
55
65
  .filter(Boolean)
56
66
  .sort();
@@ -61,6 +71,70 @@ function empreinteDesDependances(copie, verrou, dansCopie) {
61
71
  return h.digest('hex');
62
72
  }
63
73
 
74
+ // The submodules of the copy <copie> posed and its commands mounted (`scripts/sous-modules.sh`), its
75
+ // `node_modules` a directory of its own, a link found there removed: `{ monter, lancer }`, the
76
+ // command line of a mounted command and the run of a command of the project, its output given to
77
+ // <ecrire>, or `{ refus }`.
78
+ export function monterDans(copie, ecrire = s => process.stdout.write(s)) {
79
+ const modules = path.join(copie, 'node_modules');
80
+ if (lstatSync(modules, { throwIfNoEntry: false })?.isSymbolicLink()) {
81
+ unlinkSync(modules);
82
+ }
83
+ const poses = spawnSync('bash', [SOUS_MODULES, 'pose', copie], { encoding: 'utf8' });
84
+ if (poses.status !== 0) {
85
+ return { refus: `La copie ne pose pas ses sous-modules : ${poses.stderr.trim()}` };
86
+ }
87
+ const monter = (...commande) => [
88
+ SOUS_MODULES,
89
+ 'monter',
90
+ copie,
91
+ '--partages',
92
+ poses.stdout,
93
+ ...commande,
94
+ ];
95
+ const montage = spawnSync('bash', monter('true'), { encoding: 'utf8' });
96
+ if (montage.status !== 0) {
97
+ return { refus: montage.stderr.trim() };
98
+ }
99
+ const lancer = (commande, args, env = process.env) => {
100
+ const r = spawnSync('bash', monter(commande, ...args), {
101
+ cwd: copie,
102
+ encoding: 'utf8',
103
+ env,
104
+ maxBuffer: SORTIE_MAX,
105
+ });
106
+ ecrire(r.stdout + r.stderr);
107
+ // After every command, green or red, `git update-index -q --refresh` re-reads the stat data of
108
+ // the files it touched (a hard link changes an inode date), as git does before it judges a
109
+ // tree. A refresh that fails changes nothing to the result, which is the command's.
110
+ spawnSync('git', ['-C', copie, 'update-index', '-q', '--refresh']);
111
+ return r;
112
+ };
113
+ return { monter, lancer };
114
+ }
115
+
116
+ // The one point that makes the dependencies of <copie> agree with the lock file and the manifests of
117
+ // the moment: the key of node_modules is compared with their fingerprint, `npm ci` runs (`lancer`
118
+ // of `monterDans`, under <env>) when they differ, the key is written again. Null when they agree,
119
+ // else the refusal.
120
+ export function accorderLesDependances(copie, lancer, env) {
121
+ const verrouNpm = path.join(copie, VERROU);
122
+ if (!existsSync(verrouNpm)) {
123
+ return null;
124
+ }
125
+ const cle = path.join(copie, 'node_modules', '.integration-lock');
126
+ const empreinte = empreinteDesDependances(copie, verrouNpm);
127
+ if (existsSync(cle) && readFileSync(cle, 'utf8') === empreinte) {
128
+ return null;
129
+ }
130
+ if (lancer('npm', ['ci', '--no-audit', '--no-fund', '--silent'], env).status !== 0) {
131
+ return DEPENDANCES_REFUSEES;
132
+ }
133
+ mkdirSync(path.dirname(cle), { recursive: true });
134
+ writeFileSync(cle, empreinte);
135
+ return null;
136
+ }
137
+
64
138
  // The copy <copie> ready on <ref>, or `{ refus }`. `dire` writes a progress line. Returns the
65
139
  // copy's tools: `dansCopie` (git in the copy), `monter` (the command line of a mounted command),
66
140
  // `installer`, and `tete`, the commit the copy was made ready on.
@@ -68,7 +142,7 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
68
142
  const git = (...args) => spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
69
143
  const dansCopie = (...args) => spawnSync('git', ['-C', copie, ...args], { encoding: 'utf8' });
70
144
  const tete = git('rev-parse', ref).stdout.trim();
71
- let partages = '';
145
+ let montee;
72
146
  const preparer = () => {
73
147
  const prete = existsSync(copie)
74
148
  ? dansCopie('checkout', '-q', '--detach', '--force', tete).status === 0 &&
@@ -77,16 +151,8 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
77
151
  if (!prete) {
78
152
  return `La copie ${copie} ne se prépare pas.`;
79
153
  }
80
- const modules = path.join(copie, 'node_modules');
81
- if (lstatSync(modules, { throwIfNoEntry: false })?.isSymbolicLink()) {
82
- unlinkSync(modules);
83
- }
84
- const poses = spawnSync('bash', [SOUS_MODULES, 'pose', copie], { encoding: 'utf8' });
85
- if (poses.status !== 0) {
86
- return `La copie ne pose pas ses sous-modules : ${poses.stderr.trim()}`;
87
- }
88
- partages = poses.stdout;
89
- return null;
154
+ montee = monterDans(copie);
155
+ return montee.refus ?? null;
90
156
  };
91
157
  const existait = existsSync(copie);
92
158
  let refus = preparer();
@@ -103,56 +169,13 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
103
169
  if (refus) {
104
170
  return { refus };
105
171
  }
106
- const monter = (...commande) => [
107
- SOUS_MODULES,
108
- 'monter',
109
- copie,
110
- '--partages',
111
- partages,
112
- ...commande,
113
- ];
114
- const montage = spawnSync('bash', monter('true'), { encoding: 'utf8' });
115
- if (montage.status !== 0) {
116
- return { refus: montage.stderr.trim() };
117
- }
118
- const lancer = (commande, args) => {
119
- const r = spawnSync('bash', monter(commande, ...args), {
120
- cwd: copie,
121
- encoding: 'utf8',
122
- maxBuffer: SORTIE_MAX,
123
- });
124
- process.stdout.write(r.stdout + r.stderr);
125
- // After every command, green or red, `git update-index -q --refresh` re-reads the stat data of
126
- // the files it touched (a hard link changes an inode date), as git does before it judges a
127
- // tree. A refresh that fails changes nothing to the result, which is the command's.
128
- dansCopie('update-index', '-q', '--refresh');
129
- return r;
130
- };
131
- const npm = args => lancer('npm', args);
132
- // The one point that makes the dependencies agree with the lock file and the manifests of the
133
- // moment: the key of node_modules is compared with their fingerprint, `npm ci` runs when they
134
- // differ, the key is written again. Null when they agree, else the refusal.
135
- const accorder = () => {
136
- const verrouNpm = path.join(copie, VERROU);
137
- if (!existsSync(verrouNpm)) {
138
- return null;
139
- }
140
- const cle = path.join(copie, 'node_modules', '.integration-lock');
141
- const empreinte = empreinteDesDependances(copie, verrouNpm, dansCopie);
142
- if (existsSync(cle) && readFileSync(cle, 'utf8') === empreinte) {
143
- return null;
144
- }
145
- if (npm(['ci', '--no-audit', '--no-fund', '--silent']).status !== 0) {
146
- return DEPENDANCES_REFUSEES;
147
- }
148
- writeFileSync(cle, empreinte);
149
- return null;
150
- };
151
- const refusOuverture = accorder();
172
+ const { monter, lancer } = montee;
173
+ const installer = () => accorderLesDependances(copie, lancer);
174
+ const refusOuverture = installer();
152
175
  if (refusOuverture) {
153
176
  return { refus: refusOuverture };
154
177
  }
155
178
  dire(`✓ copie propre sur ${tete.slice(0, 7)}`);
156
179
 
157
- return { dansCopie, monter, installer: accorder, tete };
180
+ return { dansCopie, monter, installer, tete };
158
181
  }
@@ -411,10 +411,6 @@ export function ouvrirAvancement(o: {
411
411
  export function inscrireLePlan(dossier: string, o: { racine: string; taches: unknown[] }): void;
412
412
  /** Keeps the total of a pass that ended, for the next one's measure. */
413
413
  export function garderLeTotal(dossier: string): void;
414
- /** Names the progress directory of the pass that holds the part its `env` marks, in the file of its
415
- * part (scripts/places-de-la-machine.mjs), where the board reads it; the function that takes it
416
- * out. */
417
- export function nommerLAvancement(o: { env?: NodeJS.ProcessEnv; dossier: string }): () => void;
418
414
  /** Opens the base of a pass of the kind `genre` (scripts/mesure/base-de-passe.mjs). */
419
415
  export function ouvrirBase(genre: string, o?: { dans?: string }): unknown;
420
416
  /** Whether `chemin` lies in a temporary directory under `env` (scripts/mesure/base-de-passe.mjs). */
@@ -430,9 +426,6 @@ export function avecLeFichierDuPoste<T extends Record<string, string | undefined
430
426
  env: T,
431
427
  o: { fichier: string; ajouts?: Record<string, string>; lire?: (f: string) => string | null }
432
428
  ): T;
433
- /** Whether the Nuit flow of the copy at <racine> plays the measures of time itself: one of its
434
- * commands runs `tests-de-nuit --mesures`; false without a flow (scripts/flux-de-la-nuit.mjs). */
435
- export function fluxDuProjetJoueLesMesures(racine: string): boolean;
436
429
  /** The path of the command <nom> in the PATH of <env>, or null (scripts/commandes-du-path.mjs). */
437
430
  export function trouverDansLePath(nom: string, env?: NodeJS.ProcessEnv): string | null;
438
431
  /**
@@ -463,10 +456,6 @@ export function retirerALInterruption(retirer: () => void): () => void;
463
456
  export const SEUIL_PRESSION: number;
464
457
  /** The exit code of a pass « à repasser » (scripts/codes-de-sortie.mjs). */
465
458
  export const A_REPASSER: number;
466
- /** The file a pass cut by the watch of its memory leaves in its results directory. */
467
- export const MEMOIRE_COUPEE: string;
468
- /** The script of the watch of the memory, which a pass runs under (scripts/garde-de-la-memoire.mjs). */
469
- export const GARDE_DE_LA_MEMOIRE: string;
470
459
  /** The variable of the workers of the tests of a task (scripts/places-de-la-machine.mjs). */
471
460
  export const VARIABLE_TRAVAILLEURS: string;
472
461
  /** The file of Beads that holds the prefix of the tickets (scripts/prefixe-des-tickets.mjs). */
@@ -479,17 +468,6 @@ export function ecrireLePrefixe(racine: string, valeur: string): string | null;
479
468
  export function lirePression(fichier?: string): number | null;
480
469
  /** The pressure `p` as a line says it. */
481
470
  export function ecrirePression(p: number | null): string;
482
- /** Waits until the pressure (`lire`) is under the threshold, or until the instant `limite` (ms),
483
- * saying through `dire` that it waits, one line per 30 s at most: true at rest, or on a pressure
484
- * that does not read, said; false at the bound (scripts/mesure/pression.mjs). */
485
- export function attendreLeRepos(o: {
486
- lire?: () => number | null;
487
- maintenant?: () => number;
488
- dormir?: (ms: number) => void;
489
- limite: number;
490
- pasMs?: number;
491
- dire: (ligne: string) => void;
492
- }): boolean;
493
471
  /** The variable naming the files changed since the last green (scripts/dernier-vert.mjs). */
494
472
  export const CHANGEMENTS: string;
495
473
  /** The variable naming the commit of the last green a run measures itself from. */
@@ -507,21 +485,20 @@ export function mesure(racine: string, o?: { tout?: boolean; dans?: string }): u
507
485
  * and a pass set), or null without the variable (the tool's own default); refuses a value that is
508
486
  * not a positive integer, by name. */
509
487
  export function travailleursDeLaSeance(env?: NodeJS.ProcessEnv): number | null;
510
- /** The wait of a pass for the room or the part of the machine, ended without it
488
+ /** The wait of a pass for the room or the reservation of the machine, ended without it
511
489
  * (scripts/attente-de-la-machine.mjs). */
512
490
  export class AttenteDeLaMachine extends Error {}
513
491
  /**
514
- * Plays a pass on its part of the machine, held to it by the system, keeping its consumption when
515
- * heavy (scripts/passe-de-la-machine.mjs).
492
+ * Plays a pass on its reservation of the arbiter of the machine, held to it by the system, keeping
493
+ * its consumption when heavy (scripts/passe-de-la-machine.mjs).
516
494
  */
517
495
  export function avecLaPasse(...args: unknown[]): unknown;
518
- /** Plays a pass on its part of the machine: its exit code, or the code of the wait that stops. */
496
+ /** Plays a pass on its reservation of the machine: its exit code, or the code of the wait that stops. */
519
497
  export function surUnePart(
520
498
  passe: (env: NodeJS.ProcessEnv, part: { coeurs: number; memoire: number } | null) => number,
521
499
  o?: {
522
500
  env?: NodeJS.ProcessEnv;
523
501
  racine?: string;
524
- mesure?: boolean;
525
502
  dire?: (l: string) => void;
526
503
  }
527
504
  ): number;
@@ -599,6 +576,9 @@ export function tachesDuVerdict<T extends { tache: string }>(
599
576
  dossier: string,
600
577
  ecrites: T[]
601
578
  ): (TacheDuResume | T)[];
579
+ /** Whether the pass is complete: `--tout` or `--force` among the raw arguments of `verifier`. */
580
+ export function passeComplete(args: readonly string[]): boolean;
581
+
602
582
  /** The content of the variable `TESTS_CIBLES` for a targeted run: the paths and options it names, and
603
583
  * the moment of the run when `force` (the task plays for real); undefined when there is nothing to
604
584
  * carry. */
@@ -651,6 +631,33 @@ export function constructionDuGraphe(args: string[]): boolean;
651
631
  * (a sweep that asks many questions of a tree that does not move), at each call otherwise
652
632
  * (scripts/lecture-unique.mjs). */
653
633
  export function luUneFois<T>(cle: string, lire: () => T): T;
634
+ /** The findings of the guards `lectures-des-tests` (scripts/lectures-communes.mjs): one per test of
635
+ * `tests` (from the root of `racine`) whose text reads a document or a file of code of the
636
+ * repository, without the label `@lit-source: <raison>`; `lectures` gives, from a test's text,
637
+ * its path and a function that resolves a path to the file it names (or null), the files it reads. */
638
+ export function constatsDesLectures(
639
+ racine: string,
640
+ tests: string[],
641
+ lectures: (
642
+ texte: string,
643
+ test: string,
644
+ lire: (valeur: string) => string | null
645
+ ) => (string | null)[]
646
+ ): { fichier: string; regle: string; message: string }[];
647
+ /** The reading of an expression of path, shared by the guards `lectures-des-tests`: the arguments
648
+ * of the call whose `(` is at an index, a string literal, the expression that follows an index up
649
+ * to its end of statement, the join of resolved parts (null when one is unresolved), a text
650
+ * without its comments. */
651
+ export const analyse: {
652
+ argumentsDuAppel(texte: string, ouvrante: number): string[];
653
+ expressionDepuis(texte: string, debut: number): string;
654
+ joindre(parts: (string | null)[]): string | null;
655
+ litteral(s: string): string | null;
656
+ sansCommentaires(texte: string, options?: { bloc?: boolean; diese?: boolean }): string;
657
+ };
658
+ /** The base of the lot of the copy at `copie`: the parent of the commit of the lot the circuit
659
+ * posed when it is its HEAD, else HEAD; null out of git (scripts/etat-du-depot.mjs). */
660
+ export function baseDuLot(copie: string): string | null;
654
661
  /** True when the text of a ticket's comment is an arbitrage (scripts/arbitrages.mjs). */
655
662
  export function estArbitrage(text: string | null | undefined): boolean;
656
663
  /** True when the arbitrage `a` of `comments` is settled. */
@@ -36,7 +36,7 @@ export function ecrireLaTrace(
36
36
  ): { ecrit: boolean };
37
37
  export function traceDeLaFile(e: { ticket: string; evenement: 'lance' | 'termine' }): Trace;
38
38
  export function traceDesPlaces(e: {
39
- evenement: 'prise' | 'rendue' | 'attente';
39
+ evenement: 'prise' | 'rendue' | 'attente' | 'cran';
40
40
  ticket?: string | null;
41
41
  place?: string | null;
42
42
  raison?: string;
@@ -5,7 +5,7 @@
5
5
  //
6
6
  // npx grillhouse tests [--force] [<chemin>…] [--<option>…] tester
7
7
  // npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
8
- // npx grillhouse verifier [--tout | --gardes] verifier
8
+ // npx grillhouse verifier [--tout | --force | --gardes] verifier
9
9
  // node commandes.mjs typer typer
10
10
  // npx grillhouse index-interfaces the guard, its own script
11
11
  //
@@ -51,6 +51,7 @@ import {
51
51
  gesteDuPackageJson,
52
52
  GRAPHE_JOUE,
53
53
  joueCeQuiNeSeDivisePas,
54
+ lancerEntiersEtFichiers,
54
55
  lancerLesTaches,
55
56
  ligneDesRestes,
56
57
  nomDuPaquet,
@@ -59,6 +60,7 @@ import {
59
60
  SCRIPT_DES_TESTS,
60
61
  SCRIPTS_DE_GARDES,
61
62
  surUnePart,
63
+ passeComplete,
62
64
  testsCibles,
63
65
  travailleursDeLaSeance,
64
66
  trouverDansLePath,
@@ -352,16 +354,29 @@ function tester(racine, args, env) {
352
354
  if (noms.size === 0) {
353
355
  return 0;
354
356
  }
355
- return lancerLesTaches({
356
- outil: OUTIL,
357
- racine,
358
- taches: [SCRIPT_DES_TESTS],
359
- noms,
360
- tests: testsCibles({
361
- arguments: [...chemins.map(c => path.resolve(racine, c)), ...options],
362
- force: args.includes('--force'),
363
- }),
364
- env,
357
+ return lancerEntiersEtFichiers({
358
+ chemins: chemins.map(c => path.resolve(racine, c)),
359
+ dossiers: tous.map(c => c.dossier),
360
+ options,
361
+ force: passeComplete(args),
362
+ lancer: ({ chemins: lot, tests }) => {
363
+ const duLot = lot.length
364
+ ? nomsDuGraphe(
365
+ racine,
366
+ choisir(racine, tous, lot).choix.map(x => x.c)
367
+ ).noms
368
+ : noms;
369
+ return duLot.size
370
+ ? lancerLesTaches({
371
+ outil: OUTIL,
372
+ racine,
373
+ taches: [SCRIPT_DES_TESTS],
374
+ noms: duLot,
375
+ tests,
376
+ env,
377
+ })
378
+ : 0;
379
+ },
365
380
  });
366
381
  }
367
382
 
@@ -414,7 +429,7 @@ function verifier(racine, args, env) {
414
429
  racine,
415
430
  taches: [TYPAGE, SCRIPT_DES_TESTS],
416
431
  noms,
417
- tests: testsCibles({ arguments: [], force: args.includes('--tout') }),
432
+ tests: testsCibles({ arguments: [], force: passeComplete(args) }),
418
433
  env,
419
434
  });
420
435
  if (code !== 0) {