@roomi-fields/grillhouse 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +769 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/bin/grillhouse.mjs +79 -18
  8. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  9. package/cadre/templates/projet/CLAUDE.md +5 -1
  10. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  11. package/cadre/templates/projet/package.json +2 -2
  12. package/charte.md +24 -0
  13. package/dist/temporal/acte.d.ts +24 -0
  14. package/dist/temporal/acte.js +139 -0
  15. package/dist/temporal/acte.js.map +1 -0
  16. package/dist/temporal/attributs.d.ts +6 -0
  17. package/dist/temporal/attributs.js +15 -0
  18. package/dist/temporal/attributs.js.map +1 -0
  19. package/dist/temporal/circuit/activites.d.ts +13 -0
  20. package/dist/temporal/circuit/activites.js +33 -0
  21. package/dist/temporal/circuit/activites.js.map +1 -0
  22. package/dist/temporal/circuit/client.d.ts +72 -0
  23. package/dist/temporal/circuit/client.js +247 -0
  24. package/dist/temporal/circuit/client.js.map +1 -0
  25. package/dist/temporal/circuit/commande.d.ts +2 -0
  26. package/dist/temporal/circuit/commande.js +238 -0
  27. package/dist/temporal/circuit/commande.js.map +1 -0
  28. package/dist/temporal/circuit/contrat.d.ts +305 -0
  29. package/dist/temporal/circuit/contrat.js +30 -0
  30. package/dist/temporal/circuit/contrat.js.map +1 -0
  31. package/dist/temporal/circuit/deroule.d.ts +3 -0
  32. package/dist/temporal/circuit/deroule.js +540 -0
  33. package/dist/temporal/circuit/deroule.js.map +1 -0
  34. package/dist/temporal/client.d.ts +47 -0
  35. package/dist/temporal/client.js +69 -0
  36. package/dist/temporal/client.js.map +1 -0
  37. package/dist/temporal/commande.d.ts +2 -0
  38. package/dist/temporal/commande.js +94 -0
  39. package/dist/temporal/commande.js.map +1 -0
  40. package/dist/temporal/deroules.d.ts +5 -0
  41. package/dist/temporal/deroules.js +10 -0
  42. package/dist/temporal/deroules.js.map +1 -0
  43. package/dist/temporal/etat.d.ts +33 -0
  44. package/dist/temporal/etat.js +59 -0
  45. package/dist/temporal/etat.js.map +1 -0
  46. package/dist/temporal/file/activites.d.ts +10 -0
  47. package/dist/temporal/file/activites.js +25 -0
  48. package/dist/temporal/file/activites.js.map +1 -0
  49. package/dist/temporal/file/client.d.ts +4 -0
  50. package/dist/temporal/file/client.js +6 -0
  51. package/dist/temporal/file/client.js.map +1 -0
  52. package/dist/temporal/file/contrat.d.ts +158 -0
  53. package/dist/temporal/file/contrat.js +14 -0
  54. package/dist/temporal/file/contrat.js.map +1 -0
  55. package/dist/temporal/file/deroule.d.ts +15 -0
  56. package/dist/temporal/file/deroule.js +235 -0
  57. package/dist/temporal/file/deroule.js.map +1 -0
  58. package/dist/temporal/installation.d.ts +120 -0
  59. package/dist/temporal/installation.js +386 -0
  60. package/dist/temporal/installation.js.map +1 -0
  61. package/dist/temporal/places/activites.d.ts +8 -0
  62. package/dist/temporal/places/activites.js +13 -0
  63. package/dist/temporal/places/activites.js.map +1 -0
  64. package/dist/temporal/places/client.d.ts +28 -0
  65. package/dist/temporal/places/client.js +64 -0
  66. package/dist/temporal/places/client.js.map +1 -0
  67. package/dist/temporal/places/contrat.d.ts +106 -0
  68. package/dist/temporal/places/contrat.js +21 -0
  69. package/dist/temporal/places/contrat.js.map +1 -0
  70. package/dist/temporal/places/deroule.d.ts +3 -0
  71. package/dist/temporal/places/deroule.js +198 -0
  72. package/dist/temporal/places/deroule.js.map +1 -0
  73. package/dist/temporal/sonde/activites.d.ts +6 -0
  74. package/dist/temporal/sonde/activites.js +52 -0
  75. package/dist/temporal/sonde/activites.js.map +1 -0
  76. package/dist/temporal/sonde/contrat.d.ts +35 -0
  77. package/dist/temporal/sonde/contrat.js +10 -0
  78. package/dist/temporal/sonde/contrat.js.map +1 -0
  79. package/dist/temporal/sonde/deroule.d.ts +3 -0
  80. package/dist/temporal/sonde/deroule.js +39 -0
  81. package/dist/temporal/sonde/deroule.js.map +1 -0
  82. package/dist/temporal/tickets/activites.d.ts +7 -0
  83. package/dist/temporal/tickets/activites.js +81 -0
  84. package/dist/temporal/tickets/activites.js.map +1 -0
  85. package/dist/temporal/tickets/client.d.ts +10 -0
  86. package/dist/temporal/tickets/client.js +31 -0
  87. package/dist/temporal/tickets/client.js.map +1 -0
  88. package/dist/temporal/tickets/contrat.d.ts +56 -0
  89. package/dist/temporal/tickets/contrat.js +13 -0
  90. package/dist/temporal/tickets/contrat.js.map +1 -0
  91. package/dist/temporal/tickets/deroule.d.ts +3 -0
  92. package/dist/temporal/tickets/deroule.js +94 -0
  93. package/dist/temporal/tickets/deroule.js.map +1 -0
  94. package/dist/temporal/travailleur.d.ts +2 -0
  95. package/dist/temporal/travailleur.js +69 -0
  96. package/dist/temporal/travailleur.js.map +1 -0
  97. package/docs/ARCHITECTURE.md +646 -87
  98. package/docs/CADRE.md +27 -0
  99. package/docs/INTERFACE.md +139 -42
  100. package/hooks/crochet.mjs +19 -2
  101. package/hooks/hooks.json +11 -0
  102. package/package.json +16 -4
  103. package/scripts/activites.mjs +2255 -0
  104. package/scripts/aiguillage.d.mts +37 -0
  105. package/scripts/aiguillage.mjs +40 -14
  106. package/scripts/avancement.mjs +155 -26
  107. package/scripts/bilan.mjs +137 -43
  108. package/scripts/cadre.mjs +16 -4
  109. package/scripts/circuit.mjs +993 -4075
  110. package/scripts/circuits-cles.d.mts +4 -0
  111. package/scripts/circuits-cles.mjs +21 -0
  112. package/scripts/circuits-du-serveur.mjs +105 -0
  113. package/scripts/codes-de-sortie.mjs +9 -0
  114. package/scripts/commandes-composees.mjs +45 -41
  115. package/scripts/commandes-du-path.d.mts +7 -0
  116. package/scripts/commandes-du-path.mjs +25 -0
  117. package/scripts/composants-affectes.mjs +64 -21
  118. package/scripts/composition-des-langages.mjs +18 -12
  119. package/scripts/conformite.mjs +56 -28
  120. package/scripts/copies-finies.mjs +52 -47
  121. package/scripts/depart-du-ticket.d.mts +53 -0
  122. package/scripts/depart-du-ticket.mjs +124 -0
  123. package/scripts/dependances-internes.mjs +121 -0
  124. package/scripts/dernier-vert.mjs +61 -34
  125. package/scripts/dette.mjs +32 -11
  126. package/scripts/donnees-cles.mjs +244 -0
  127. package/scripts/droits.mjs +51 -16
  128. package/scripts/effets.mjs +352 -0
  129. package/scripts/empreinte-d-etape.mjs +17 -0
  130. package/scripts/engendres.mjs +15 -5
  131. package/scripts/enveloppe/enveloppe.mjs +259 -55
  132. package/scripts/enveloppe/lancer.sh +14 -18
  133. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  134. package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
  135. package/scripts/etapes.mjs +5 -2
  136. package/scripts/faits-du-circuit.mjs +493 -0
  137. package/scripts/file-des-tickets.d.mts +21 -0
  138. package/scripts/file-des-tickets.mjs +58 -0
  139. package/scripts/flux-des-paquets.mjs +201 -0
  140. package/scripts/gardes-du-cadre.mjs +21 -5
  141. package/scripts/init.mjs +11 -4
  142. package/scripts/integration/file.mjs +544 -434
  143. package/scripts/integration/integrer.mjs +87 -43
  144. package/scripts/integration/rejeu.mjs +45 -13
  145. package/scripts/jointure.d.ts +151 -28
  146. package/scripts/langages/cargo/commandes.mjs +383 -124
  147. package/scripts/langages/cargo/composants.mjs +154 -42
  148. package/scripts/langages/cargo/exemples.mjs +12 -21
  149. package/scripts/langages/cargo/index.mjs +22 -8
  150. package/scripts/langages/cargo/sccache.mjs +8 -14
  151. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  152. package/scripts/langages/python/commandes.mjs +218 -100
  153. package/scripts/langages/python/composants.mjs +53 -21
  154. package/scripts/langages/python/exemples.mjs +6 -16
  155. package/scripts/langages/python/index.mjs +28 -8
  156. package/scripts/langages/python/lot.mjs +1 -36
  157. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  158. package/scripts/langages/typescript/composants.mjs +9 -3
  159. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  160. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  161. package/scripts/langages/typescript/construire.mjs +6 -163
  162. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  163. package/scripts/langages/typescript/exemples.mjs +3 -11
  164. package/scripts/langages/typescript/frontieres.mjs +66 -22
  165. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  166. package/scripts/langages/typescript/index.mjs +50 -61
  167. package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
  168. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  169. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  170. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  171. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  172. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  173. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
  174. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  175. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  176. package/scripts/langages/typescript/parcours.mjs +12 -4
  177. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  178. package/scripts/langages/typescript/resumes.mjs +9 -3
  179. package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
  180. package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
  181. package/scripts/langages/typescript/tests.mjs +40 -15
  182. package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
  183. package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
  184. package/scripts/langages/typescript/verdict.mjs +4 -2
  185. package/scripts/langages/typescript/verifier.mjs +58 -20
  186. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  187. package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
  188. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  189. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  190. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  191. package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
  192. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  193. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
  194. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
  195. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  196. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
  197. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  198. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  199. package/scripts/lint-des-scripts.mjs +58 -0
  200. package/scripts/mesure/base-de-passe.mjs +117 -25
  201. package/scripts/mesure/pression.mjs +12 -6
  202. package/scripts/mesure-de-la-machine.d.mts +21 -0
  203. package/scripts/mesure-de-la-machine.mjs +76 -0
  204. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  205. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  206. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  207. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
  208. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  209. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  210. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
  211. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  212. package/scripts/migrations.mjs +5 -0
  213. package/scripts/nuit.sh +25 -3
  214. package/scripts/outil.mjs +3 -1
  215. package/scripts/outils-cles.d.mts +24 -0
  216. package/scripts/outils-cles.mjs +18 -8
  217. package/scripts/paquet-npm.mjs +157 -0
  218. package/scripts/paquet.mjs +73 -4
  219. package/scripts/paquets.mjs +46 -10
  220. package/scripts/passe-de-la-machine.mjs +71 -0
  221. package/scripts/places-de-la-machine.mjs +414 -0
  222. package/scripts/places-du-serveur.mjs +170 -0
  223. package/scripts/prefixe-des-tickets.mjs +68 -0
  224. package/scripts/preparation.mjs +25 -8
  225. package/scripts/registre.mjs +9 -4
  226. package/scripts/regles-des-places.d.mts +36 -0
  227. package/scripts/regles-des-places.mjs +70 -0
  228. package/scripts/reponses-du-circuit.d.mts +6 -0
  229. package/scripts/reponses-du-circuit.mjs +28 -0
  230. package/scripts/reprise.mjs +66 -0
  231. package/scripts/resultats.mjs +112 -46
  232. package/scripts/retirer-les-copies-finies.mjs +25 -0
  233. package/scripts/sans-reponse.d.mts +4 -0
  234. package/scripts/sans-reponse.mjs +13 -0
  235. package/scripts/seances.mjs +936 -0
  236. package/scripts/services-du-noyau.mjs +27 -8
  237. package/scripts/session-start.sh +2 -2
  238. package/scripts/sortie.mjs +3 -3
  239. package/scripts/sous-commandes.mjs +41 -10
  240. package/scripts/style-a-l-ecriture.mjs +260 -0
  241. package/scripts/superviseur.mjs +122 -111
  242. package/scripts/tableau.mjs +180 -117
  243. package/scripts/taches-du-graphe.mjs +348 -0
  244. package/scripts/ticket-du-circuit.mjs +216 -0
  245. package/scripts/transitions.d.mts +148 -0
  246. package/scripts/transitions.mjs +1018 -0
  247. package/scripts/verrou-de-fichier.mjs +8 -4
  248. package/scripts/verrou-de-machine.mjs +150 -51
  249. package/scripts/verrous/commande.mjs +50 -17
  250. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  251. package/scripts/verrous/verrou.mjs +42 -14
  252. package/skills/explorateur/SKILL.md +9 -2
  253. package/skills/grill/SKILL.md +1 -1
  254. package/skills/mesure/SKILL.md +3 -0
  255. package/skills/pitmaster/SKILL.md +17 -18
  256. package/skills/pitmaster/references/consigne-agent.md +5 -1
  257. package/skills/release/SKILL.md +3 -3
  258. package/skills/relecteur/SKILL.md +5 -3
  259. package/skills/testwriter/SKILL.md +49 -31
  260. package/scripts/demon.mjs +0 -251
  261. package/scripts/integration/file-attente.mjs +0 -61
  262. package/scripts/langages/cargo/touches.mjs +0 -93
  263. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -0,0 +1,37 @@
1
+ // The types of ./aiguillage.mjs, for the frame's TypeScript (src/temporal/installation.ts) and its
2
+ // tests.
3
+
4
+ /** The key of the project's package.json that names its version of the frame. */
5
+ export const CLE: string;
6
+ /** The name of the frame's package. */
7
+ export const NOM_DU_PAQUET: string;
8
+ /** A version x.y.z. */
9
+ export const X_Y_Z: RegExp;
10
+ /** The subcommands of the orchestration, which the published version runs. */
11
+ export const REDIRIGEES: Set<string>;
12
+ /** The subcommands of the code that runs, the ticket's copy for a session of the circuit. */
13
+ export const DU_CODE_EN_COURS: Set<string>;
14
+ /** The tools of the repository. */
15
+ export const OUTILS_DU_DEPOT: Set<string>;
16
+
17
+ /** The cache of the versions installed under the home <maison>, ~/.cache/grillhouse/outil by default. */
18
+ export function cacheDesOutils(maison?: string): string;
19
+ /** The folder of the version <version> under <cache>. */
20
+ export function dossierDeLOutil(version: string, cache?: string): string;
21
+ /** The version the project at <racine> names, or null; throws on a value that is no version. */
22
+ export function versionDeLOutil(racine?: string): string | null;
23
+ /** Where the subcommand <nom> runs in the project at <racine>, or null for the code that runs. */
24
+ export function aiguillage(
25
+ nom: string,
26
+ options?: { racine?: string; cache?: string; paquet?: string }
27
+ ): { version: string; dossier: string; commande: string } | null;
28
+ /** The failed installation of the version the project at <racine> names, or null. */
29
+ export function echecDeLOutil(
30
+ racine?: string,
31
+ options?: { cache?: string }
32
+ ): { version: string; raison: string; date: string } | null;
33
+ /** Installs the published version <version> under <cache>: its folder, and whether it laid it down. */
34
+ export function installer(
35
+ version: string,
36
+ options?: { cache?: string; npm?: string; retenue?: number }
37
+ ): { dossier: string; installe: boolean };
@@ -54,7 +54,7 @@ const PAQUET_QUI_TOURNE = path.resolve(import.meta.dirname, '..');
54
54
  /**
55
55
  * The subcommands of the orchestration, which the published version runs: the circuit, the
56
56
  * supervisor, the night, the board and the status line, the hooks of Claude Code, the locks and
57
- * the rights of the sessions, the envelope and its launcher, the integration and the queue, the
57
+ * the rights of the sessions, the envelope and its launcher, the integration, the
58
58
  * results, the removal of a copy and the balance, even when the supervisor runs one by hand.
59
59
  */
60
60
  export const REDIRIGEES = new Set([
@@ -63,7 +63,6 @@ export const REDIRIGEES = new Set([
63
63
  'commande',
64
64
  'droits',
65
65
  'enveloppe',
66
- 'file',
67
66
  'integrer',
68
67
  'lancer',
69
68
  'ligne-etat',
@@ -86,11 +85,14 @@ export const REDIRIGEES = new Set([
86
85
  */
87
86
  export const DU_CODE_EN_COURS = new Set([
88
87
  'composants-affectes',
88
+ 'dependances-internes',
89
+ 'flux-des-paquets',
89
90
  'fusion-du-changelog',
90
91
  'gardes-du-cadre',
91
92
  'hook',
92
93
  'hooks',
93
94
  'langages-des-paquets',
95
+ 'style-a-l-ecriture',
94
96
  'temporaire',
95
97
  'tests',
96
98
  'verifier',
@@ -106,6 +108,7 @@ export const OUTILS_DU_DEPOT = new Set([
106
108
  'pression',
107
109
  'sortie',
108
110
  'sous-modules',
111
+ 'temporal',
109
112
  'ticket',
110
113
  ]);
111
114
 
@@ -113,7 +116,8 @@ export const OUTILS_DU_DEPOT = new Set([
113
116
  const RETENUE_MS = 5 * 60 * 1000;
114
117
 
115
118
  // The cache of the published versions: ~/.cache/grillhouse/outil.
116
- const cacheDesOutils = () => path.join(os.homedir(), '.cache', 'grillhouse', 'outil');
119
+ export const cacheDesOutils = (maison = os.homedir()) =>
120
+ path.join(maison, '.cache', 'grillhouse', 'outil');
117
121
 
118
122
  /** The folder of the version <version> under <cache>. */
119
123
  export const dossierDeLOutil = (version, cache = cacheDesOutils()) => path.join(cache, version);
@@ -144,7 +148,9 @@ export function versionDeLOutil(racine = process.cwd()) {
144
148
  return null;
145
149
  }
146
150
  const v = pkg?.grillhouse?.outil;
147
- if (v === undefined || v === null) return null;
151
+ if (v === undefined || v === null) {
152
+ return null;
153
+ }
148
154
  if (typeof v !== 'string' || !X_Y_Z.test(v)) {
149
155
  throw new Error(`la clé ${CLE} vaut ${JSON.stringify(v)}, pas une version x.y.z.`);
150
156
  }
@@ -163,12 +169,18 @@ export function aiguillage(
163
169
  nom,
164
170
  { racine = process.cwd(), cache = cacheDesOutils(), paquet = PAQUET_QUI_TOURNE } = {}
165
171
  ) {
166
- if (!REDIRIGEES.has(nom)) return null;
172
+ if (!REDIRIGEES.has(nom)) {
173
+ return null;
174
+ }
167
175
  const version = versionDeLOutil(racine);
168
- if (version === null) return null;
176
+ if (version === null) {
177
+ return null;
178
+ }
169
179
  const dossier = dossierDeLOutil(version, cache);
170
180
  const commande = commandeDans(dossier);
171
- if (realpath(paquet) === realpath(path.resolve(path.dirname(commande), '..'))) return null;
181
+ if (realpath(paquet) === realpath(path.resolve(path.dirname(commande), '..'))) {
182
+ return null;
183
+ }
172
184
  return { version, dossier, commande };
173
185
  }
174
186
 
@@ -202,7 +214,9 @@ export function echecDeLOutil(racine = process.cwd(), { cache = cacheDesOutils()
202
214
  } catch {
203
215
  return null;
204
216
  }
205
- if (version === null) return null;
217
+ if (version === null) {
218
+ return null;
219
+ }
206
220
  const f = fichierDEchec(version, cache);
207
221
  // A failure written after another launch installed the version: the version stands.
208
222
  if (existsSync(commandeDans(dossierDeLOutil(version, cache)))) {
@@ -224,7 +238,9 @@ function balayer(cache) {
224
238
  }
225
239
  for (const e of entrees) {
226
240
  const pid = Number(/\.installation-(\d+)$/.exec(e)?.[1]);
227
- if (pid && !vivant(pid)) rmSync(path.join(cache, e), { recursive: true, force: true });
241
+ if (pid && !vivant(pid)) {
242
+ rmSync(path.join(cache, e), { recursive: true, force: true });
243
+ }
228
244
  }
229
245
  }
230
246
 
@@ -246,7 +262,9 @@ function npmInstall(npm, prefixe, specs) {
246
262
  { stdio: ['ignore', 2, 'pipe'], encoding: 'utf8' }
247
263
  );
248
264
  process.stderr.write(r.stderr ?? '');
249
- if (r.status === 0) return;
265
+ if (r.status === 0) {
266
+ return;
267
+ }
250
268
  const ligne = String(r.stderr ?? '')
251
269
  .trim()
252
270
  .split('\n')
@@ -271,10 +289,14 @@ export function installer(
271
289
  { cache = cacheDesOutils(), npm = 'npm', retenue = RETENUE_MS } = {}
272
290
  ) {
273
291
  const dossier = dossierDeLOutil(version, cache);
274
- if (existsSync(commandeDans(dossier))) return { dossier, installe: false };
292
+ if (existsSync(commandeDans(dossier))) {
293
+ return { dossier, installe: false };
294
+ }
275
295
  const echec = fichierDEchec(version, cache);
276
296
  const garde = lireLEchec(echec);
277
- if (garde && Date.now() - Date.parse(garde.date) < retenue) throw new Error(garde.raison);
297
+ if (garde && Date.now() - Date.parse(garde.date) < retenue) {
298
+ throw new Error(garde.raison);
299
+ }
278
300
  mkdirSync(cache, { recursive: true });
279
301
  balayer(cache);
280
302
  const chantier = `${dossier}.installation-${process.pid}`;
@@ -287,7 +309,9 @@ export function installer(
287
309
  readFileSync(path.join(chantier, 'node_modules', NOM_DU_PAQUET, 'package.json'), 'utf8')
288
310
  );
289
311
  const pairs = Object.entries(pkg.peerDependencies ?? {}).map(([n, r]) => `${n}@${r}`);
290
- if (pairs.length) npmInstall(npm, chantier, pairs);
312
+ if (pairs.length) {
313
+ npmInstall(npm, chantier, pairs);
314
+ }
291
315
  if (!existsSync(commandeDans(chantier))) {
292
316
  throw new Error(`npm n'a pas posé la commande de ${NOM_DU_PAQUET}@${version}`);
293
317
  }
@@ -301,7 +325,9 @@ export function installer(
301
325
  renameSync(chantier, dossier);
302
326
  } catch (e) {
303
327
  // Another launch installed it meanwhile: its folder stands.
304
- if (!existsSync(commandeDans(dossier))) throw e;
328
+ if (!existsSync(commandeDans(dossier))) {
329
+ throw e;
330
+ }
305
331
  }
306
332
  return { dossier, installe: true };
307
333
  } finally {
@@ -4,12 +4,19 @@
4
4
  //
5
5
  // - A pass has its progress directory, which the variable GRILLHOUSE_AVANCEMENT (AVANCEMENT of
6
6
  // scripts/mesure/avancement.mjs) names to its commands: the circuit opens one for each
7
- // automatic pass and names it in its state (scripts/circuit.mjs), `npm run verifier` opens its own when it
8
- // receives none (scripts/langages/typescript/verifier.mjs). The directory holds `passe.json` (`{ genre, debut,
9
- // precedent }`: its kind, its start, the total of the previous pass of that kind), the records
10
- // of its tasks (`taches/`, written by the reporter of progress of the base configuration, one
7
+ // automatic pass in its working directory, `<copie>.travail`, where the board reads it
8
+ // (`avancementDuTravail`), `npm run verifier` opens its own when it receives none
9
+ // (scripts/langages/typescript/verifier.mjs). The directory holds `passe.json` (`{ genre, debut,
10
+ // precedent, totaux }`: its kind, its start, the total of the previous pass of that kind, and
11
+ // the file of the totals where its end keeps its own), the records of its tasks (`taches/`, written by the reporter of progress of the base configuration, one
11
12
  // per run of Vitest, and by the queue for the steps of its CI, scripts/integration/file.mjs),
12
13
  // and the plans of its runs of Turborepo (`plan/`).
14
+ // - The CI of a ticket's commit is read by one act at a time, each a process of its own: its
15
+ // readings share one progress directory in the working directory of the ticket,
16
+ // `avancement-ci` (`avancementDeLaCI`), opened by the first and emptied when a reading looks
17
+ // for a run again (another CI, after a reopening), where the board reads the steps
18
+ // of the run done over planned while the circuit waits for it; the next pass of the circuit
19
+ // removes it with the others (`avecLAvancementDuTravail`).
13
20
  // - The reading adds the records: the files done, and the files planned of the tasks started;
14
21
  // while every task the plans name has not started, the total of the previous pass of the same
15
22
  // kind stands when it is greater (a pass without a plan never knows all its tasks started).
@@ -28,14 +35,16 @@
28
35
  // board reads the holder with its progress, and the waits for the lock or for room
29
36
  // (`lireLaMesure`).
30
37
  import { spawnSync } from 'node:child_process';
31
- import { mkdtempSync, readdirSync, readFileSync } from 'node:fs';
38
+ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs';
32
39
  import { tmpdir } from 'node:os';
33
40
  import path from 'node:path';
34
- import { ecrireAtomique, TACHES } from './mesure/avancement.mjs';
41
+ import { AVANCEMENT, ecrireAtomique, TACHES } from './mesure/avancement.mjs';
35
42
  import { lireLeVerrou } from './verrou-de-machine.mjs';
36
43
 
37
44
  const PASSE = 'passe.json';
38
45
  const PLAN = 'plan';
46
+ // The name of a progress directory starts so (`ouvrirAvancement`).
47
+ const PREFIXE = 'avancement-';
39
48
  const TACHES_GARDEES = 2_000;
40
49
 
41
50
  const lireJson = f => {
@@ -64,21 +73,26 @@ function fichierDesTotaux(racine) {
64
73
  );
65
74
  return r.status === 0 ? path.join(r.stdout.trim(), 'grillhouse', 'avancement.json') : null;
66
75
  }
67
- const lireLesTotaux = racine => {
68
- const f = fichierDesTotaux(racine);
76
+ // The totals read in the file <f>, empty without one.
77
+ const totauxDe = f => {
69
78
  const t = f ? lireJson(f) : null;
70
79
  return { fichier: f, passes: t?.passes ?? {}, taches: t?.taches ?? {} };
71
80
  };
81
+ // The totals of the repository at <racine>.
82
+ const lireLesTotaux = racine => totauxDe(fichierDesTotaux(racine));
72
83
 
73
84
  /**
74
85
  * Opens the progress directory of a pass of kind <genre> (null: a pass whose total is not kept)
75
- * in the repository at <racine>, made under <dans>, its start <debut>; its path.
86
+ * in the repository at <racine>, made under <dans>, its start <debut>; its path. The file of the
87
+ * totals is resolved now and kept in `passe.json` (`totaux`): the integration removes the ticket's
88
+ * copy before its pass ends, and its total goes to the same repository.
76
89
  * @param {{ racine: string, genre?: string | null, dans?: string, debut?: number }} o
77
90
  */
78
91
  export function ouvrirAvancement({ racine, genre = null, dans = tmpdir(), debut = Date.now() }) {
79
- const dossier = mkdtempSync(path.join(dans, 'avancement-'));
80
- const precedent = genre ? (lireLesTotaux(racine).passes[genre] ?? null) : null;
81
- ecrireAtomique(path.join(dossier, PASSE), { genre, debut, precedent });
92
+ const dossier = mkdtempSync(path.join(dans, PREFIXE));
93
+ const totaux = lireLesTotaux(racine);
94
+ const precedent = genre ? (totaux.passes[genre] ?? null) : null;
95
+ ecrireAtomique(path.join(dossier, PASSE), { genre, debut, precedent, totaux: totaux.fichier });
82
96
  return dossier;
83
97
  }
84
98
 
@@ -91,7 +105,9 @@ export function ouvrirAvancement({ racine, genre = null, dans = tmpdir(), debut
91
105
  * @param {{ racine: string, taches: { hash: string, cache: boolean }[] }} o
92
106
  */
93
107
  export function inscrireLePlan(dossier, { racine, taches }) {
94
- if (!dossier || !taches.length) return;
108
+ if (!dossier || !taches.length) {
109
+ return;
110
+ }
95
111
  const { taches: connues } = lireLesTotaux(racine);
96
112
  try {
97
113
  for (const t of taches.filter(x => x.cache)) {
@@ -119,11 +135,16 @@ function enregistrements(dossier) {
119
135
  const sans = [];
120
136
  for (const f of lister(path.join(dossier, TACHES))) {
121
137
  const e = lireJson(path.join(dossier, TACHES, f));
122
- if (!e || !Number.isFinite(e.faits) || !Number.isFinite(e.prevus)) continue;
123
- if (!e.hash) sans.push(e);
124
- else {
138
+ if (!e || !Number.isFinite(e.faits) || !Number.isFinite(e.prevus)) {
139
+ continue;
140
+ }
141
+ if (!e.hash) {
142
+ sans.push(e);
143
+ } else {
125
144
  const avant = parHash.get(e.hash);
126
- if (!avant || (!e.cache && (avant.cache || e.a > avant.a))) parHash.set(e.hash, e);
145
+ if (!avant || (!e.cache && (avant.cache || e.a > avant.a))) {
146
+ parHash.set(e.hash, e);
147
+ }
127
148
  }
128
149
  }
129
150
  return [...parHash.values(), ...sans];
@@ -137,7 +158,9 @@ function enregistrements(dossier) {
137
158
  */
138
159
  export function lireAvancement(dossier) {
139
160
  const passe = lireJson(path.join(dossier, PASSE));
140
- if (!passe) return null;
161
+ if (!passe) {
162
+ return null;
163
+ }
141
164
  const liste = enregistrements(dossier);
142
165
  const faits = liste.reduce((s, e) => s + e.faits, 0);
143
166
  const demarres = liste.reduce((s, e) => s + e.prevus, 0);
@@ -154,25 +177,131 @@ export function lireAvancement(dossier) {
154
177
  return { faits, prevus, debut, dernier };
155
178
  }
156
179
 
180
+ /**
181
+ * The progress of the pass under way in the working directory <travail> of a circuit, where each
182
+ * automatic pass of the circuit opens its progress directory (`avecLAvancementDuTravail`, one
183
+ * pass at a time): the latest started that reads, null without one.
184
+ * @param {string} travail
185
+ * @returns {{ faits: number, prevus: number, debut: number, dernier: number } | null}
186
+ */
187
+ export function avancementDuTravail(travail) {
188
+ let noms = [];
189
+ try {
190
+ noms = readdirSync(travail).filter(f => f.startsWith(PREFIXE));
191
+ } catch {
192
+ return null;
193
+ }
194
+ return (
195
+ noms
196
+ .map(f => lireAvancement(path.join(travail, f)))
197
+ .filter(Boolean)
198
+ .sort((a, b) => b.debut - a.debut)[0] ?? null
199
+ );
200
+ }
201
+
202
+ /**
203
+ * The progress directory of the readings of the CI of a ticket's commit, in the working directory
204
+ * <travail> of its circuit, where the board reads it (`avancementDuTravail`): one for all its
205
+ * readings, opened by the first, emptied when <nouvelle> (a reading that looks for its run, the
206
+ * records of another run gone); null when the circuit has no working directory.
207
+ * @param {string} travail
208
+ * @param {{ nouvelle?: boolean, debut?: number }} [o]
209
+ * @returns {string | null}
210
+ */
211
+ export function avancementDeLaCI(travail, { nouvelle = false, debut = Date.now() } = {}) {
212
+ if (!existsSync(travail)) {
213
+ return null;
214
+ }
215
+ const dossier = path.join(travail, `${PREFIXE}ci`);
216
+ try {
217
+ if (nouvelle) {
218
+ rmSync(dossier, { recursive: true, force: true });
219
+ }
220
+ if (!existsSync(path.join(dossier, PASSE))) {
221
+ mkdirSync(dossier, { recursive: true });
222
+ ecrireAtomique(path.join(dossier, PASSE), { genre: null, debut, precedent: null });
223
+ }
224
+ } catch {
225
+ // A directory that does not write leaves the queue going, without its progress.
226
+ return null;
227
+ }
228
+ return dossier;
229
+ }
230
+
231
+ /**
232
+ * Runs <passe> under a progress directory of the kind <genre> (null: none kept) opened in the
233
+ * working directory <travail> of a ticket's circuit, where the board reads it
234
+ * (`avancementDuTravail`): each automatic pass of the circuit (scripts/activites.mjs) and the
235
+ * replay of the ticket's branch by the queue (scripts/faits-du-circuit.mjs `avancer`), one pass at
236
+ * a time. The directories a killed pass left there go first, a lot that goes through the queue
237
+ * again included. The directory is given to <passe> and named to it and its children by
238
+ * GRILLHOUSE_AVANCEMENT (`AVANCEMENT`); then its total is kept in the repository at <racine> and
239
+ * it is removed, unless <garder> holds for what <passe> returns: a lot entered on main keeps it
240
+ * until the queue is done with the ticket closed, which removes the working directory whole
241
+ * (`retirerLeTravail` of scripts/integration/file.mjs), as the circuit kept its progress for its
242
+ * whole step of the queue. Without the working directory, <passe> runs without one (null).
243
+ * Returns what <passe> returns.
244
+ * @template T
245
+ * @param {string} travail
246
+ * @param {{ racine: string, genre: string | null, garder?: (valeur: T) => boolean }} o
247
+ * @param {(dossier: string | null) => T} passe
248
+ * @returns {T}
249
+ */
250
+ export function avecLAvancementDuTravail(travail, { racine, genre, garder = () => false }, passe) {
251
+ if (!existsSync(travail)) {
252
+ return passe(null);
253
+ }
254
+ for (const f of readdirSync(travail).filter(n => n.startsWith(PREFIXE))) {
255
+ rmSync(path.join(travail, f), { recursive: true, force: true });
256
+ }
257
+ const dossier = ouvrirAvancement({ racine, genre, dans: travail });
258
+ const avant = process.env[AVANCEMENT];
259
+ process.env[AVANCEMENT] = dossier;
260
+ let garde = false;
261
+ try {
262
+ const valeur = passe(dossier);
263
+ garde = garder(valeur);
264
+ return valeur;
265
+ } finally {
266
+ if (avant === undefined) {
267
+ delete process.env[AVANCEMENT];
268
+ } else {
269
+ process.env[AVANCEMENT] = avant;
270
+ }
271
+ garderLeTotal(dossier);
272
+ if (!garde) {
273
+ rmSync(dossier, { recursive: true, force: true });
274
+ }
275
+ }
276
+ }
277
+
157
278
  /**
158
279
  * Keeps, at the end of the pass whose directory is <dossier>, its total under its kind and the
159
- * files planned of each task it played, in the totals of the repository at <racine>.
280
+ * files planned of each task it played, in the totals its opening named (`totaux` of its
281
+ * `passe.json`); none out of git.
160
282
  * @param {string} dossier
161
- * @param {string} racine
162
283
  */
163
- export function garderLeTotal(dossier, racine) {
284
+ export function garderLeTotal(dossier) {
164
285
  const passe = lireJson(path.join(dossier, PASSE));
165
- if (!passe) return;
166
- const t = lireLesTotaux(racine);
167
- if (!t.fichier) return;
286
+ if (!passe) {
287
+ return;
288
+ }
289
+ const t = totauxDe(passe.totaux ?? null);
290
+ if (!t.fichier) {
291
+ return;
292
+ }
168
293
  const liste = enregistrements(dossier);
169
- if (passe.genre && liste.length) t.passes[passe.genre] = liste.reduce((s, e) => s + e.prevus, 0);
294
+ if (passe.genre && liste.length) {
295
+ t.passes[passe.genre] = liste.reduce((s, e) => s + e.prevus, 0);
296
+ }
170
297
  for (const e of liste.filter(x => x.hash && !x.cache)) {
171
298
  delete t.taches[e.hash];
172
299
  t.taches[e.hash] = e.prevus;
173
300
  }
174
301
  const cles = Object.keys(t.taches);
175
- for (const c of cles.slice(0, Math.max(0, cles.length - TACHES_GARDEES))) delete t.taches[c];
302
+ for (const c of cles.slice(0, Math.max(0, cles.length - TACHES_GARDEES))) {
303
+ delete t.taches[c];
304
+ }
176
305
  try {
177
306
  ecrireAtomique(t.fichier, { passes: t.passes, taches: t.taches });
178
307
  } catch {