@roomi-fields/grillhouse 0.30.0 → 0.32.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 (153) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +48 -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/dist/temporal/circuit/client.d.ts +2 -2
  8. package/dist/temporal/circuit/client.js.map +1 -1
  9. package/dist/temporal/circuit/commande.js +4 -4
  10. package/dist/temporal/circuit/commande.js.map +1 -1
  11. package/dist/temporal/circuit/contrat.d.ts +3 -3
  12. package/dist/temporal/circuit/contrat.js +8 -2
  13. package/dist/temporal/circuit/contrat.js.map +1 -1
  14. package/dist/temporal/circuit/deroule.js +3 -3
  15. package/dist/temporal/circuit/deroule.js.map +1 -1
  16. package/dist/temporal/commande.js +5 -6
  17. package/dist/temporal/commande.js.map +1 -1
  18. package/dist/temporal/installation.d.ts +3 -6
  19. package/dist/temporal/installation.js +19 -38
  20. package/dist/temporal/installation.js.map +1 -1
  21. package/dist/temporal/tickets/activites.d.ts +1 -0
  22. package/dist/temporal/tickets/activites.js +5 -0
  23. package/dist/temporal/tickets/activites.js.map +1 -1
  24. package/dist/temporal/tickets/contrat.d.ts +10 -0
  25. package/dist/temporal/tickets/deroule.js +8 -1
  26. package/dist/temporal/tickets/deroule.js.map +1 -1
  27. package/docs/ARCHITECTURE.md +119 -27
  28. package/docs/CADRE.md +20 -0
  29. package/docs/INTERFACE.md +17 -4
  30. package/hooks/hooks.json +4 -0
  31. package/package.json +2 -2
  32. package/scripts/activites.mjs +155 -84
  33. package/scripts/aiguillage.mjs +35 -11
  34. package/scripts/attente-au-tour.mjs +99 -0
  35. package/scripts/avancement.mjs +27 -10
  36. package/scripts/base-des-workflows.mjs +57 -0
  37. package/scripts/bilan.mjs +101 -25
  38. package/scripts/cadre.mjs +5 -2
  39. package/scripts/circuit.mjs +173 -58
  40. package/scripts/composants-affectes.mjs +64 -21
  41. package/scripts/composition-des-langages.mjs +5 -3
  42. package/scripts/conformite.mjs +54 -19
  43. package/scripts/copies-finies.mjs +8 -1
  44. package/scripts/dependances-internes.mjs +9 -3
  45. package/scripts/dernier-vert.mjs +84 -23
  46. package/scripts/dette.mjs +32 -11
  47. package/scripts/donnees-cles.mjs +24 -8
  48. package/scripts/droits.mjs +40 -15
  49. package/scripts/effets.mjs +9 -0
  50. package/scripts/empreinte-d-etape.mjs +17 -0
  51. package/scripts/engendres.mjs +15 -5
  52. package/scripts/enveloppe/enveloppe.mjs +141 -48
  53. package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
  54. package/scripts/etapes.mjs +1 -1
  55. package/scripts/faits-du-circuit.mjs +1 -1
  56. package/scripts/flux-des-paquets.mjs +21 -7
  57. package/scripts/gardes-du-cadre.mjs +9 -3
  58. package/scripts/init.mjs +11 -4
  59. package/scripts/integration/file.mjs +84 -29
  60. package/scripts/integration/integrer.mjs +70 -24
  61. package/scripts/integration/rejeu.mjs +26 -9
  62. package/scripts/jointure.d.ts +10 -1
  63. package/scripts/journal-des-etats.d.mts +41 -0
  64. package/scripts/journal-des-etats.mjs +273 -0
  65. package/scripts/journal.mjs +119 -0
  66. package/scripts/langages/cargo/commandes.mjs +97 -18
  67. package/scripts/langages/cargo/composants.mjs +24 -8
  68. package/scripts/langages/cargo/index.mjs +7 -0
  69. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  70. package/scripts/langages/python/commandes.mjs +3 -1
  71. package/scripts/langages/python/index.mjs +6 -0
  72. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  73. package/scripts/langages/typescript/composants.mjs +9 -3
  74. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  75. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  76. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  77. package/scripts/langages/typescript/frontieres.mjs +112 -22
  78. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  79. package/scripts/langages/typescript/index.mjs +12 -3
  80. package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
  81. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  82. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  83. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  84. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  85. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
  86. package/scripts/langages/typescript/parcours.mjs +12 -4
  87. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  88. package/scripts/langages/typescript/resumes.mjs +9 -3
  89. package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
  90. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
  91. package/scripts/langages/typescript/tests.mjs +24 -8
  92. package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
  93. package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
  94. package/scripts/langages/typescript/verdict.mjs +3 -1
  95. package/scripts/langages/typescript/verifier.mjs +61 -14
  96. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  97. package/scripts/langages/typescript/vitest-config/base.mjs +10 -2
  98. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  99. package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
  100. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
  101. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
  102. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  103. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
  104. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  105. package/scripts/langages.d.mts +20 -0
  106. package/scripts/lint-des-scripts.mjs +58 -0
  107. package/scripts/matiere-de-test.d.ts +11 -0
  108. package/scripts/mesure/base-de-passe.mjs +117 -25
  109. package/scripts/mesure/pression.mjs +9 -3
  110. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  111. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  112. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  113. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
  114. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  115. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  116. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
  117. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
  118. package/scripts/nuit.sh +24 -0
  119. package/scripts/outil.mjs +3 -1
  120. package/scripts/outils-cles.mjs +18 -7
  121. package/scripts/paquet-npm.mjs +15 -5
  122. package/scripts/paquets.mjs +12 -4
  123. package/scripts/passe-de-la-machine.mjs +7 -2
  124. package/scripts/places-de-la-machine.mjs +72 -12
  125. package/scripts/preparation.mjs +15 -5
  126. package/scripts/registre.mjs +6 -2
  127. package/scripts/reprise.mjs +66 -0
  128. package/scripts/resultats.mjs +105 -37
  129. package/scripts/seances.mjs +22 -4
  130. package/scripts/services-du-noyau.mjs +1 -0
  131. package/scripts/sous-commandes.mjs +5 -1
  132. package/scripts/style-a-l-ecriture.mjs +48 -17
  133. package/scripts/superviseur.mjs +127 -75
  134. package/scripts/tableau.mjs +133 -10
  135. package/scripts/taches-du-graphe.mjs +33 -13
  136. package/scripts/ticket-du-circuit.mjs +40 -0
  137. package/scripts/transitions.mjs +159 -29
  138. package/scripts/verrou-de-fichier.mjs +6 -2
  139. package/scripts/verrou-de-machine.mjs +123 -39
  140. package/scripts/verrous/commande.mjs +50 -17
  141. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  142. package/scripts/verrous/verrou.mjs +42 -14
  143. package/skills/developpeur/SKILL.md +1 -1
  144. package/skills/explorateur/SKILL.md +8 -2
  145. package/skills/grill/SKILL.md +3 -57
  146. package/skills/grill/references/paquets.md +60 -0
  147. package/skills/mesure/SKILL.md +3 -0
  148. package/skills/pitmaster/SKILL.md +16 -27
  149. package/skills/questionneur/SKILL.md +1 -1
  150. package/skills/relecteur/SKILL.md +2 -2
  151. package/skills/testwriter/SKILL.md +19 -7
  152. package/skills/release/SKILL.md +0 -134
  153. package/skills/release/scripts/update-version.cjs +0 -92
@@ -122,8 +122,12 @@ function proprietaire(base) {
122
122
  function orpheline(base) {
123
123
  const p = proprietaire(base);
124
124
  const ici = espace();
125
- if (p === null || ici === null || p.espace !== ici) return false;
126
- if (typeof p.racine === 'string') return !existsSync(p.racine);
125
+ if (p === null || ici === null || p.espace !== ici) {
126
+ return false;
127
+ }
128
+ if (typeof p.racine === 'string') {
129
+ return !existsSync(p.racine);
130
+ }
127
131
  return Number.isInteger(p.pid) && !vivant(p.pid);
128
132
  }
129
133
 
@@ -139,8 +143,9 @@ function balayer(dans, { vieilles = false } = {}) {
139
143
  }
140
144
  for (const nom of noms) {
141
145
  const base = path.join(dans, nom);
142
- if (nom.startsWith(PREFIXE) && (orpheline(base) || (vieilles && vieille(base))))
146
+ if (nom.startsWith(PREFIXE) && (orpheline(base) || (vieilles && vieille(base)))) {
143
147
  rmSync(base, { recursive: true, force: true });
148
+ }
144
149
  }
145
150
  }
146
151
 
@@ -150,7 +155,9 @@ export const AGE_DU_CACHE_MS = 7 * 24 * 3600 * 1000;
150
155
  // Whether <base> is a base of a cache of a root untouched (its directory's mtime) for
151
156
  // AGE_DU_CACHE_MS.
152
157
  function vieille(base) {
153
- if (typeof proprietaire(base)?.racine !== 'string') return false;
158
+ if (typeof proprietaire(base)?.racine !== 'string') {
159
+ return false;
160
+ }
154
161
  try {
155
162
  return Date.now() - statSync(base).mtimeMs > AGE_DU_CACHE_MS;
156
163
  } catch {
@@ -164,9 +171,13 @@ const enEnveloppe = env => Boolean(env.GRILLHOUSE_ENVELOPPE);
164
171
  // The sweep of the caches of the roots under <env> (`cacheDeLaRacine`, in each tool's directory of
165
172
  // the frame's caches), from the host only: the orphans and the old ones.
166
173
  function balayerLesCaches(env) {
167
- if (enEnveloppe(env)) return;
174
+ if (enEnveloppe(env)) {
175
+ return;
176
+ }
168
177
  const racine = path.dirname(cacheDeCompilation('-', env));
169
- for (const outil of contenu(racine)) balayer(path.join(racine, outil), { vieilles: true });
178
+ for (const outil of contenu(racine)) {
179
+ balayer(path.join(racine, outil), { vieilles: true });
180
+ }
170
181
  }
171
182
 
172
183
  // The variables that name the temporary directory: TMPDIR (POSIX, Node, Rust), TMP and TEMP
@@ -186,11 +197,16 @@ function contenu(dossier) {
186
197
  * The line of the guard of a pass of tests: what its tests left in their temporary directory,
187
198
  * named; null when they left nothing.
188
199
  * @param {string[]} restes the names left (`restes` of a base)
200
+ * @param {string} [paquet] the package whose tests played under that directory, when the pass
201
+ * gives each package its own; the line names it
189
202
  * @returns {string | null}
190
203
  */
191
- export function ligneDesRestes(restes) {
192
- if (restes.length === 0) return null;
193
- return `⛔ Les tests ont laissé dans leur dossier temporaire : ${restes.join(', ')}. Un test retire ce qu'il y crée, rouge compris.`;
204
+ export function ligneDesRestes(restes, paquet) {
205
+ if (restes.length === 0) {
206
+ return null;
207
+ }
208
+ const de = paquet ? `Les tests de ${paquet} ont` : 'Les tests ont';
209
+ return `⛔ ${de} laissé dans leur dossier temporaire : ${restes.join(', ')}. Un test retire ce qu'il y crée, rouge compris.`;
194
210
  }
195
211
 
196
212
  // The signals that interrupt a pass: Ctrl-C, a kill, the end of its terminal.
@@ -205,34 +221,89 @@ const INTERRUPTIONS = ['SIGINT', 'SIGTERM', 'SIGHUP'];
205
221
  */
206
222
  export function retirerALInterruption(retirer) {
207
223
  const lacher = () => {
208
- for (const s of INTERRUPTIONS) process.removeListener(s, surSignal);
224
+ for (const s of INTERRUPTIONS) {
225
+ process.removeListener(s, surSignal);
226
+ }
209
227
  };
210
228
  function surSignal(signal) {
211
229
  lacher();
212
230
  retirer();
213
231
  process.kill(process.pid, signal);
214
232
  }
215
- for (const s of INTERRUPTIONS) process.on(s, surSignal);
233
+ for (const s of INTERRUPTIONS) {
234
+ process.on(s, surSignal);
235
+ }
216
236
  return lacher;
217
237
  }
218
238
 
239
+ // The trial directories under the home (`racineSousLaMaison`, grillhouse-matiere): their prefix, and
240
+ // how long one without a readable owner file waits before it goes (the ones the passes before the
241
+ // owner file left, and one being created).
242
+ const ESSAIS = `${PREFIXE}essais-`;
243
+ const AGE_DES_ESSAIS_MS = 24 * 3600 * 1000;
244
+
245
+ // The cache directory of the home, where the trial directories lie.
246
+ const cacheDeLaMaison = () => path.join(process.env.HOME || homedir(), '.cache');
247
+
248
+ // Whether the owner <p> of a trial directory is a pass of this namespace that is gone: its number
249
+ // is free, or reused by a process that started at another time.
250
+ function passeMorte(p) {
251
+ const ici = espace();
252
+ if (p === null || ici === null || p.espace !== ici || !Number.isInteger(p.pid)) {
253
+ return false;
254
+ }
255
+ return typeof p.depart === 'string' ? !leMemeVivant(p.pid, p.depart) : !vivant(p.pid);
256
+ }
257
+
258
+ // Removes from the home's cache every trial directory whose pass is gone, and, from the host
259
+ // only (the home is read-only in an envelope, whose namespace is its own), the ones without a
260
+ // readable owner file older than a day.
261
+ function balayerLesEssais(env) {
262
+ if (enEnveloppe(env)) {
263
+ return;
264
+ }
265
+ const cache = cacheDeLaMaison();
266
+ for (const nom of contenu(cache)) {
267
+ if (!nom.startsWith(ESSAIS)) {
268
+ continue;
269
+ }
270
+ const dossier = path.join(cache, nom);
271
+ const p = proprietaire(dossier);
272
+ let retirer = false;
273
+ if (p === null) {
274
+ try {
275
+ retirer = Date.now() - statSync(dossier).mtimeMs > AGE_DES_ESSAIS_MS;
276
+ } catch {
277
+ retirer = false;
278
+ }
279
+ } else {
280
+ retirer = passeMorte(p);
281
+ }
282
+ if (retirer) {
283
+ rmSync(dossier, { recursive: true, force: true });
284
+ }
285
+ }
286
+ }
287
+
219
288
  /**
220
- * Opens the base of a pass of <genre> in <dans>, after sweeping the orphan bases there.
289
+ * Opens the base of a pass of <genre> in <dans>, after sweeping the orphan bases there, and the
290
+ * orphan trial directories under the home.
221
291
  * @param {string} genre what the pass is (`vitest`, `circuit`…), in the base's name
222
292
  * @param {{ dans?: string }} options `dans`, the directory of the base (`os.tmpdir()`)
223
293
  * @returns {{ base: string, dossier: string, env: Record<string, string>, restes: () => string[],
224
- * fermer: () => void }} the base; the directory its pass writes in; the variables that name it
225
- * to the pass's children (TMPDIR, TMP, TEMP); what is in it, sorted; and the removal of the base
294
+ * essais: () => string[], fermer: () => void }} the base; the directory its pass writes in; the
295
+ * variables that name it to the pass's children (TMPDIR, TMP, TEMP); what is in it, sorted; the
296
+ * names of the `grillhouse-essais-*` directories of the home's cache whose owner file names this
297
+ * pass, read at the call; and the removal of the base
226
298
  */
227
299
  export function ouvrirBase(genre, { dans = tmpdir() } = {}) {
228
300
  balayer(dans);
229
301
  balayerLesCaches(process.env);
302
+ balayerLesEssais(process.env);
230
303
  mkdirSync(dans, { recursive: true });
231
304
  const base = mkdtempSync(path.join(dans, `${PREFIXE}${genre}-`));
232
- writeFileSync(
233
- path.join(base, PROPRIETAIRE),
234
- `${JSON.stringify({ pid: process.pid, espace: espace() })}\n`
235
- );
305
+ const moi = { pid: process.pid, depart: departDe(process.pid), espace: espace() };
306
+ writeFileSync(path.join(base, PROPRIETAIRE), `${JSON.stringify(moi)}\n`);
236
307
  const dossier = path.join(base, 't');
237
308
  mkdirSync(dossier);
238
309
  return {
@@ -240,6 +311,14 @@ export function ouvrirBase(genre, { dans = tmpdir() } = {}) {
240
311
  dossier,
241
312
  env: Object.fromEntries(TEMPORAIRES.map(v => [v, dossier])),
242
313
  restes: () => contenu(dossier),
314
+ essais: () =>
315
+ contenu(cacheDeLaMaison()).filter(nom => {
316
+ if (!nom.startsWith(ESSAIS)) {
317
+ return false;
318
+ }
319
+ const p = proprietaire(path.join(cacheDeLaMaison(), nom));
320
+ return p?.pid === moi.pid && p.depart === moi.depart && p.espace === moi.espace;
321
+ }),
243
322
  fermer: () => rmSync(base, { recursive: true, force: true }),
244
323
  };
245
324
  }
@@ -257,7 +336,9 @@ const ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
257
336
  * @returns {{ base: string, dossier: string }} the base, and the directory its agents write in
258
337
  */
259
338
  export function ouvrirBaseDuTicket(ticket, { dans = tmpdir() } = {}) {
260
- if (!ID.test(ticket)) throw new Error(`⛔ « ${ticket} » n'est pas l'identifiant d'un ticket.`);
339
+ if (!ID.test(ticket)) {
340
+ throw new Error(`⛔ « ${ticket} » n'est pas l'identifiant d'un ticket.`);
341
+ }
261
342
  const base = path.join(dans, `${DU_TICKET}${ticket}`);
262
343
  const dossier = path.join(base, 't');
263
344
  mkdirSync(dossier, { recursive: true });
@@ -281,11 +362,17 @@ export function balayerLesTickets(fermes, { dans = tmpdir() } = {}) {
281
362
  .filter(n => n.startsWith(DU_TICKET))
282
363
  .map(n => ({ base: path.join(dans, n), ticket: proprietaire(path.join(dans, n))?.ticket }))
283
364
  .filter(b => typeof b.ticket === 'string');
284
- if (tickets.length === 0) return [];
365
+ if (tickets.length === 0) {
366
+ return [];
367
+ }
285
368
  const clos = fermes();
286
- if (clos === null) return [];
369
+ if (clos === null) {
370
+ return [];
371
+ }
287
372
  const retires = tickets.filter(b => clos.has(b.ticket));
288
- for (const b of retires) rmSync(b.base, { recursive: true, force: true });
373
+ for (const b of retires) {
374
+ rmSync(b.base, { recursive: true, force: true });
375
+ }
289
376
  return retires.map(b => b.ticket);
290
377
  }
291
378
 
@@ -342,9 +429,14 @@ export function cacheDeLaRacine(outil, racine, env = process.env, { creer = true
342
429
  const reelle = path.resolve(racine);
343
430
  const empreinte = createHash('sha256').update(reelle).digest('hex').slice(0, 16);
344
431
  const cache = path.join(dans, `${PREFIXE}${empreinte}`);
345
- if (!creer) return cache;
346
- if (enEnveloppe(env)) balayer(dans);
347
- else balayerLesCaches(env);
432
+ if (!creer) {
433
+ return cache;
434
+ }
435
+ if (enEnveloppe(env)) {
436
+ balayer(dans);
437
+ } else {
438
+ balayerLesCaches(env);
439
+ }
348
440
  mkdirSync(cache, { recursive: true });
349
441
  // A use renews it: its age counts from the last.
350
442
  const maintenant = new Date();
@@ -64,9 +64,13 @@ export function attendreLeRepos({
64
64
  dire('⏳ pression CPU illisible : la relance part sans attendre, verdict des tests.');
65
65
  return true;
66
66
  }
67
- if (p < SEUIL_PRESSION) return true;
67
+ if (p < SEUIL_PRESSION) {
68
+ return true;
69
+ }
68
70
  const t = maintenant();
69
- if (t >= limite) return false;
71
+ if (t >= limite) {
72
+ return false;
73
+ }
70
74
  if (t - derniere >= ECART_LIGNES_MS) {
71
75
  const reste = Math.ceil((limite - t) / 60_000);
72
76
  dire(
@@ -85,7 +89,9 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
85
89
  } else {
86
90
  const dire = l => process.stdout.write(`${l}\n`);
87
91
  const repos = attendreLeRepos({ limite: Date.now() + BORNE_ATTENTE_MS, dire });
88
- if (!repos) dire(`⏳ pas de repos en ${BORNE_ATTENTE_MS / 60_000} min.`);
92
+ if (!repos) {
93
+ dire(`⏳ pas de repos en ${BORNE_ATTENTE_MS / 60_000} min.`);
94
+ }
89
95
  process.exitCode = repos ? 0 : A_REPASSER;
90
96
  }
91
97
  }
@@ -30,10 +30,14 @@ const PARAGRAPHE_DU_GREFFON =
30
30
  /** Brings the import of the common charter to the project's CLAUDE.md; returns what it did. */
31
31
  export function migrer(projet) {
32
32
  const fichier = path.join(projet, 'CLAUDE.md');
33
- if (!existsSync(fichier)) return [];
33
+ if (!existsSync(fichier)) {
34
+ return [];
35
+ }
34
36
  const texte = readFileSync(fichier, 'utf8');
35
37
  const imports = [...texte.matchAll(IMPORT_D_UNE_CHARTE)].map(m => `@${m[1]}`);
36
- if (imports.some(i => i !== ANCIENNE_COPIE)) return [];
38
+ if (imports.some(i => i !== ANCIENNE_COPIE)) {
39
+ return [];
40
+ }
37
41
  let neuf;
38
42
  if (imports.length > 0) {
39
43
  neuf = texte.replaceAll(ANCIENNE_COPIE, IMPORT);
@@ -27,9 +27,13 @@ const duCadre = crochet =>
27
27
  /** Removes the frame's former session hooks from the project's settings; returns what it did. */
28
28
  export function migrer(projet) {
29
29
  const f = path.join(projet, '.claude', 'settings.json');
30
- if (!existsSync(f)) return [];
30
+ if (!existsSync(f)) {
31
+ return [];
32
+ }
31
33
  const reglages = JSON.parse(readFileSync(f, 'utf8'));
32
- if (reglages.hooks === null || typeof reglages.hooks !== 'object') return [];
34
+ if (reglages.hooks === null || typeof reglages.hooks !== 'object') {
35
+ return [];
36
+ }
33
37
  const retires = [];
34
38
  const hooks = {};
35
39
  for (const [evenement, groupes] of Object.entries(reglages.hooks)) {
@@ -39,17 +43,30 @@ export function migrer(projet) {
39
43
  }
40
44
  const restants = groupes
41
45
  .map(g => {
42
- if (!Array.isArray(g?.hooks)) return g;
46
+ if (!Array.isArray(g?.hooks)) {
47
+ return g;
48
+ }
43
49
  const gardes = g.hooks.filter(c => !duCadre(c));
44
- for (const c of g.hooks) if (duCadre(c)) retires.push(`${evenement} : ${c.command}`);
50
+ for (const c of g.hooks) {
51
+ if (duCadre(c)) {
52
+ retires.push(`${evenement} : ${c.command}`);
53
+ }
54
+ }
45
55
  return gardes.length > 0 ? { ...g, hooks: gardes } : null;
46
56
  })
47
57
  .filter(g => g !== null);
48
- if (restants.length > 0) hooks[evenement] = restants;
58
+ if (restants.length > 0) {
59
+ hooks[evenement] = restants;
60
+ }
61
+ }
62
+ if (retires.length === 0) {
63
+ return [];
64
+ }
65
+ if (Object.keys(hooks).length > 0) {
66
+ reglages.hooks = hooks;
67
+ } else {
68
+ delete reglages.hooks;
49
69
  }
50
- if (retires.length === 0) return [];
51
- if (Object.keys(hooks).length > 0) reglages.hooks = hooks;
52
- else delete reglages.hooks;
53
70
  writeFileSync(f, `${JSON.stringify(reglages, null, 2)}\n`);
54
71
  return retires.map(r => `.claude/settings.json : crochet retiré, que le greffon porte (${r})`);
55
72
  }
@@ -49,17 +49,25 @@ const declareDuCadre = (n, e) =>
49
49
  // Takes the project's marketplace off the settings file <rel> of the project at <projet>.
50
50
  function retirerDesReglages(projet, rel) {
51
51
  const f = path.join(projet, rel);
52
- if (!existsSync(f)) return [];
52
+ if (!existsSync(f)) {
53
+ return [];
54
+ }
53
55
  const reglages = JSON.parse(readFileSync(f, 'utf8'));
54
56
  const marches = reglages.extraKnownMarketplaces;
55
- if (!marches || typeof marches !== 'object') return [];
57
+ if (!marches || typeof marches !== 'object') {
58
+ return [];
59
+ }
56
60
  const noms = Object.keys(marches).filter(n => declareDuCadre(n, marches[n]));
57
- if (noms.length === 0) return [];
61
+ if (noms.length === 0) {
62
+ return [];
63
+ }
58
64
  for (const n of noms) {
59
65
  delete marches[n];
60
66
  delete reglages.enabledPlugins?.[`grillhouse@${n}`];
61
67
  }
62
- if (Object.keys(marches).length === 0) delete reglages.extraKnownMarketplaces;
68
+ if (Object.keys(marches).length === 0) {
69
+ delete reglages.extraKnownMarketplaces;
70
+ }
63
71
  if (reglages.enabledPlugins && Object.keys(reglages.enabledPlugins).length === 0) {
64
72
  delete reglages.enabledPlugins;
65
73
  }
@@ -74,9 +82,13 @@ export function migrer(projet) {
74
82
  const manifeste = path.join(dossier, 'marketplace.json');
75
83
  if (existsSync(manifeste) && duCadre(lireJson(manifeste))) {
76
84
  rmSync(manifeste);
77
- if (readdirSync(dossier).length === 0) rmSync(dossier, { recursive: true });
85
+ if (readdirSync(dossier).length === 0) {
86
+ rmSync(dossier, { recursive: true });
87
+ }
78
88
  lignes.push('.claude-plugin/marketplace.json : place de marché du projet retirée');
79
89
  }
80
- for (const rel of REGLAGES) lignes.push(...retirerDesReglages(projet, rel));
90
+ for (const rel of REGLAGES) {
91
+ lignes.push(...retirerDesReglages(projet, rel));
92
+ }
81
93
  return lignes;
82
94
  }
@@ -68,7 +68,9 @@ const ANCIENS_CHEMINS = [
68
68
  // back to the former package's, or each name of the base back to one former path; none when it
69
69
  // wrote nothing.
70
70
  function formesAnterieures(texte) {
71
- if (texte.search(ECRIT) < 0) return [];
71
+ if (texte.search(ECRIT) < 0) {
72
+ return [];
73
+ }
72
74
  return [
73
75
  texte.replace(ECRIT, (_, q, mesure) => `${q}${ANCIEN}${mesure ?? ''}${q}`),
74
76
  ...ANCIENS_CHEMINS.map(c =>
@@ -101,17 +103,23 @@ const couvert = (lignes, f) => lignes.some(l => (l.endsWith('/') ? f.startsWith(
101
103
  // Whether the file at <absolu> has the fingerprint <attendue>, as copied or as 0.23.0 rewrote it.
102
104
  function intacte(absolu, attendue) {
103
105
  const octets = readFileSync(absolu);
104
- if (hacher(octets) === attendue) return true;
106
+ if (hacher(octets) === attendue) {
107
+ return true;
108
+ }
105
109
  return formesAnterieures(octets.toString('utf8')).some(t => hacher(t) === attendue);
106
110
  }
107
111
 
108
112
  // The files under the directory <rel> of <projet>, as paths from it.
109
113
  function fichiersSous(projet, rel) {
110
114
  const absolu = path.join(projet, rel);
111
- if (!existsSync(absolu)) return [];
115
+ if (!existsSync(absolu)) {
116
+ return [];
117
+ }
112
118
  return readdirSync(absolu, { withFileTypes: true }).flatMap(e => {
113
119
  const r = `${rel}/${e.name}`;
114
- if (e.isDirectory()) return fichiersSous(projet, r);
120
+ if (e.isDirectory()) {
121
+ return fichiersSous(projet, r);
122
+ }
115
123
  return e.isFile() ? [r] : [];
116
124
  });
117
125
  }
@@ -120,7 +128,9 @@ function fichiersSous(projet, rel) {
120
128
  function viderDossiers(projet, f) {
121
129
  for (let d = path.dirname(f); d !== '.'; d = path.dirname(d)) {
122
130
  const absolu = path.join(projet, d);
123
- if (!existsSync(absolu) || readdirSync(absolu).length > 0) return;
131
+ if (!existsSync(absolu) || readdirSync(absolu).length > 0) {
132
+ return;
133
+ }
124
134
  rmSync(absolu, { recursive: true });
125
135
  }
126
136
  }
@@ -129,7 +139,9 @@ function viderDossiers(projet, f) {
129
139
  export function migrer(projet) {
130
140
  const liste = path.join(projet, LISTE);
131
141
  const fEmpreintes = path.join(projet, EMPREINTES);
132
- if (!existsSync(liste) || !existsSync(fEmpreintes)) return [];
142
+ if (!existsSync(liste) || !existsSync(fEmpreintes)) {
143
+ return [];
144
+ }
133
145
  const lignes = gardees(readFileSync(liste, 'utf8'));
134
146
  const enregistres = Object.entries(lireJson(fEmpreintes).fichiers ?? {}).filter(
135
147
  ([f]) =>
@@ -148,7 +160,9 @@ export function migrer(projet) {
148
160
  sortie.push(ligne);
149
161
  };
150
162
  for (const [f, attendue] of enregistres) {
151
- if (!existsSync(path.join(projet, f))) continue;
163
+ if (!existsSync(path.join(projet, f))) {
164
+ continue;
165
+ }
152
166
  if (intacte(path.join(projet, f), attendue)) {
153
167
  retirer(f, `${f} : copie du cadre retirée, que le paquet porte`);
154
168
  } else if (!deRoleSupprime(f)) {
@@ -161,9 +175,13 @@ export function migrer(projet) {
161
175
  const espaces = new Set(paquets(projet).map(p => p.dossier));
162
176
  for (const d of lignes.filter(l => l.endsWith('/') && !l.startsWith(`${DOSSIER}/`))) {
163
177
  const dossier = d.replace(/\/$/, '');
164
- if (espaces.has(dossier)) continue;
178
+ if (espaces.has(dossier)) {
179
+ continue;
180
+ }
165
181
  for (const f of fichiersSous(projet, dossier)) {
166
- if (!GENERE.test(readFileSync(path.join(projet, f), 'utf8'))) continue;
182
+ if (!GENERE.test(readFileSync(path.join(projet, f), 'utf8'))) {
183
+ continue;
184
+ }
167
185
  retirer(f, `${f} : fichier engendré pour l'ancien espace de travail ${dossier}, retiré`);
168
186
  }
169
187
  }
@@ -180,12 +198,16 @@ export function migrer(projet) {
180
198
  }
181
199
 
182
200
  const fPkg = path.join(projet, 'package.json');
183
- if (!existsSync(fPkg)) return sortie;
201
+ if (!existsSync(fPkg)) {
202
+ return sortie;
203
+ }
184
204
  const pkg = lireJson(fPkg);
185
205
  const par = parCopie(projet);
186
206
  let reecrit = false;
187
207
  for (const [n, script] of Object.entries(pkg.scripts ?? {})) {
188
- if (typeof script !== 'string') continue;
208
+ if (typeof script !== 'string') {
209
+ continue;
210
+ }
189
211
  const neuf = script.replace(APPEL, (tout, avant, f) =>
190
212
  retires.has(f) && par.has(f) ? `${avant}grillhouse ${par.get(f)}` : tout
191
213
  );
@@ -208,16 +230,26 @@ export function migrer(projet) {
208
230
  });
209
231
  }
210
232
  }
211
- if (reecrit) writeFileSync(fPkg, `${JSON.stringify(pkg, null, 2)}\n`);
233
+ if (reecrit) {
234
+ writeFileSync(fPkg, `${JSON.stringify(pkg, null, 2)}\n`);
235
+ }
212
236
 
213
237
  const duPaquet = Object.keys(lireJson(path.join(PAQUET, 'package.json')).dependencies ?? {});
214
238
  const gabarit = lireJson(path.join(CADRE, GABARIT, 'package.json'));
215
239
  const textes = sources(projet).map(f => readFileSync(path.join(projet, f), 'utf8'));
216
240
  for (const dep of duPaquet.filter(d => d !== DU_PAQUET)) {
217
- if (!CHAMPS.some(c => pkg[c]?.[dep] !== undefined)) continue;
218
- if (CHAMPS.some(c => gabarit[c]?.[dep] !== undefined)) continue;
219
- if (![...retires.values()].some(t => importe(t, dep))) continue;
220
- if (textes.some(t => importe(t, dep))) continue;
241
+ if (!CHAMPS.some(c => pkg[c]?.[dep] !== undefined)) {
242
+ continue;
243
+ }
244
+ if (CHAMPS.some(c => gabarit[c]?.[dep] !== undefined)) {
245
+ continue;
246
+ }
247
+ if (![...retires.values()].some(t => importe(t, dep))) {
248
+ continue;
249
+ }
250
+ if (textes.some(t => importe(t, dep))) {
251
+ continue;
252
+ }
221
253
  sortie.push(dependanceDuPaquet(dep));
222
254
  }
223
255
  return sortie;
@@ -30,10 +30,14 @@ const REMPLACEMENTS = [
30
30
  /** Brings the rule of the tri to the project's issue-tracker.md; returns what it did. */
31
31
  export function migrer(projet) {
32
32
  const fichier = path.join(projet, FICHIER);
33
- if (!existsSync(fichier)) return [];
33
+ if (!existsSync(fichier)) {
34
+ return [];
35
+ }
34
36
  const texte = readFileSync(fichier, 'utf8');
35
37
  const neuf = REMPLACEMENTS.reduce((t, [ancien, nouveau]) => t.replace(ancien, nouveau), texte);
36
- if (neuf === texte) return [];
38
+ if (neuf === texte) {
39
+ return [];
40
+ }
37
41
  writeFileSync(fichier, neuf);
38
42
  return [
39
43
  `${FICHIER} : une découverte reçoit son verdict au tri des découvertes, en fin de ticket, au lieu de se rouvrir sur le mot du responsable`,
@@ -40,10 +40,14 @@ const dossiers = projet => [
40
40
  // The script of the package.json <rel> of <projet>; what it did, or what it leaves.
41
41
  function renommerLeScript(projet, rel) {
42
42
  const f = path.join(projet, rel);
43
- if (!existsSync(f)) return [];
43
+ if (!existsSync(f)) {
44
+ return [];
45
+ }
44
46
  const pkg = lireJson(f);
45
47
  const scripts = pkg.scripts;
46
- if (!scripts || !Object.hasOwn(scripts, ANCIEN)) return [];
48
+ if (!scripts || !Object.hasOwn(scripts, ANCIEN)) {
49
+ return [];
50
+ }
47
51
  if (Object.hasOwn(scripts, NOUVEAU) && scripts[NOUVEAU] !== scripts[ANCIEN]) {
48
52
  return [
49
53
  {
@@ -54,7 +58,9 @@ function renommerLeScript(projet, rel) {
54
58
  const double = Object.hasOwn(scripts, NOUVEAU);
55
59
  pkg.scripts = Object.fromEntries(
56
60
  Object.entries(scripts).flatMap(([k, v]) => {
57
- if (k !== ANCIEN) return [[k, v]];
61
+ if (k !== ANCIEN) {
62
+ return [[k, v]];
63
+ }
58
64
  return double ? [] : [[NOUVEAU, v]];
59
65
  })
60
66
  );
@@ -65,9 +71,13 @@ function renommerLeScript(projet, rel) {
65
71
  // The task of the turbo.json <rel> of <projet>; what it did, or what it leaves.
66
72
  function renommerLaTache(projet, rel) {
67
73
  const f = path.join(projet, rel);
68
- if (!existsSync(f)) return [];
74
+ if (!existsSync(f)) {
75
+ return [];
76
+ }
69
77
  const texte = readFileSync(f, 'utf8');
70
- if (texte.search(TACHE) < 0) return [];
78
+ if (texte.search(TACHE) < 0) {
79
+ return [];
80
+ }
71
81
  if (TACHE_NEUVE.test(texte)) {
72
82
  return [
73
83
  {
@@ -101,10 +101,14 @@ const normaliser = t =>
101
101
  /** Replaces the CI of the project by the template's when it is a former one; returns what it did. */
102
102
  export function migrer(projet) {
103
103
  const f = path.join(projet, CI);
104
- if (!existsSync(f)) return [];
104
+ if (!existsSync(f)) {
105
+ return [];
106
+ }
105
107
  const actuel = normaliser(readFileSync(f, 'utf8'));
106
108
  const neuf = readFileSync(path.join(GABARIT, CI), 'utf8');
107
- if (actuel === normaliser(neuf)) return [];
109
+ if (actuel === normaliser(neuf)) {
110
+ return [];
111
+ }
108
112
  if (ANCIENNES.some(a => normaliser(a) === actuel)) {
109
113
  writeFileSync(f, neuf);
110
114
  return [`${CI} : remplacé par celui du gabarit, qui n'appelle que \`npm run verifier\``];
@@ -19,11 +19,7 @@
19
19
  // pass changes nothing and returns no line.
20
20
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
21
21
  import path from 'node:path';
22
- import {
23
- inscrireAuxEspaces,
24
- packageJsonDuPaquet,
25
- paquetsSansPackageJson,
26
- } from '../paquet-npm.mjs';
22
+ import { inscrireAuxEspaces, packageJsonDuPaquet, paquetsSansPackageJson } from '../paquet-npm.mjs';
27
23
  import { paquets } from '../paquets.mjs';
28
24
 
29
25
  export const version = '0.31.0';
@@ -31,7 +27,9 @@ export const nom = 'paquets dans le graphe';
31
27
 
32
28
  export function migrer(projet) {
33
29
  const racinePj = path.join(projet, 'package.json');
34
- if (!existsSync(racinePj)) return [];
30
+ if (!existsSync(racinePj)) {
31
+ return [];
32
+ }
35
33
  const lignes = [];
36
34
  const inscrire = [];
37
35
  for (const { chemin, nom: nomNpm } of paquetsSansPackageJson(projet)) {
@@ -42,7 +40,9 @@ export function migrer(projet) {
42
40
  try {
43
41
  present = JSON.parse(readFileSync(abs, 'utf8')).name;
44
42
  } catch (e) {
45
- lignes.push({ aFaire: `${f} : ${e.message} ; le nom du paquet est ${JSON.stringify(nomNpm)}.` });
43
+ lignes.push({
44
+ aFaire: `${f} : ${e.message} ; le nom du paquet est ${JSON.stringify(nomNpm)}.`,
45
+ });
46
46
  continue;
47
47
  }
48
48
  if (present !== nomNpm) {
package/scripts/nuit.sh CHANGED
@@ -39,6 +39,12 @@
39
39
  # (scripts/outils-cles.mjs) gives each command of the project its variables, each set to its
40
40
  # path, whatever the environment of the night's launcher; a faulty key turns the night red, the
41
41
  # log naming it, and nothing runs.
42
+ # - TEMPORAL: after the tools of the project, before any command, the night lays the pinned program of
43
+ # Temporal down (`grillhouse temporal installer --programme-seul`, by the built command of the
44
+ # version playing the night, not the copy's: the copy has no build yet; idempotent: a program
45
+ # already laid down is not downloaded again) and exports its path as TEMPORAL, over any key left
46
+ # in a package.json; a laying that fails turns the night red, the log naming its cause, and
47
+ # nothing runs.
42
48
  # - The night tests: after the full pass, the night tests, then the measures of time alone (the
43
49
  # time budget benches and the time witnesses), which `npm test` and the integration leave out
44
50
  # (grillhouse-bd7), played by the command `tests-de-nuit` of the module of the copy's language
@@ -226,6 +232,15 @@ jouer() {
226
232
  return 1
227
233
  fi
228
234
  eval "$outils"
235
+ # The pinned program of Temporal, laid down and exported for every command. The command is that
236
+ # of the version playing the night (already built), not the copy's: the copy is cleaned of its
237
+ # build and has no node_modules before the `npm ci` below.
238
+ local temporal
239
+ if ! temporal=$(env -C "$copie" node "$ici/../bin/grillhouse.mjs" temporal installer --programme-seul); then
240
+ echo "✗ la pose du programme temporal échoue : rien n'est joué."
241
+ return 1
242
+ fi
243
+ export TEMPORAL="$temporal"
229
244
  # The data of the project (donnees-cles.mjs), exported the same way.
230
245
  local donnees
231
246
  if ! donnees=$(node "$ici/donnees-cles.mjs" "$copie"); then
@@ -237,6 +252,15 @@ jouer() {
237
252
  monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
238
253
  cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
239
254
  fi
255
+ # The frame's package, built once when the copy carries it as a package of the repository: the
256
+ # copy is cleaned of dist/ and the pass (the taking of its place) and the night tests of Temporal
257
+ # read dist/temporal. A project that installs the frame builds nothing more.
258
+ if grep -q '"name": *"@roomi-fields/grillhouse"' "$copie/packages/grillhouse/package.json" 2>/dev/null; then
259
+ if ! monter npm --prefix "$copie" run build --workspace=@roomi-fields/grillhouse; then
260
+ echo "✗ la construction du paquet @roomi-fields/grillhouse échoue : rien n'est joué."
261
+ return 1
262
+ fi
263
+ fi
240
264
  # The full pass, played for real: the night replays no log of the cache. Each step plays even
241
265
  # when one before it is red; a step à repasser ends the night there, red if a step before it is.
242
266
  local code tache avant