@roomi-fields/grillhouse 0.48.0 → 0.49.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 (147) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +6 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +9 -2
  6. package/cadre/templates/projet/CLAUDE.md +9 -5
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/cadre/templates/turbo/paquets.json +3 -1
  9. package/cadre/templates/turbo/sans-paquets.json +3 -1
  10. package/charte.md +40 -14
  11. package/dist/temporal/circuit/appel.d.ts +4 -1
  12. package/dist/temporal/circuit/appel.js +15 -1
  13. package/dist/temporal/circuit/appel.js.map +1 -1
  14. package/dist/temporal/circuit/client.d.ts +7 -1
  15. package/dist/temporal/circuit/client.js +54 -1
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +30 -57
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +2 -1
  20. package/dist/temporal/circuit/contrat.js +2 -1
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +9 -2
  23. package/dist/temporal/circuit/deroule.js.map +1 -1
  24. package/dist/temporal/file/contrat.d.ts +16 -2
  25. package/dist/temporal/file/contrat.js +27 -3
  26. package/dist/temporal/file/contrat.js.map +1 -1
  27. package/dist/temporal/file/deroule.js +4 -4
  28. package/dist/temporal/file/deroule.js.map +1 -1
  29. package/dist/temporal/nuits/activites.d.ts +1 -15
  30. package/dist/temporal/nuits/activites.js +3 -62
  31. package/dist/temporal/nuits/activites.js.map +1 -1
  32. package/dist/temporal/nuits/contrat.d.ts +3 -21
  33. package/dist/temporal/nuits/deroule.js +38 -74
  34. package/dist/temporal/nuits/deroule.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +3 -16
  36. package/dist/temporal/places/client.js +3 -26
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/dist/temporal/places/contrat.d.ts +15 -51
  39. package/dist/temporal/places/contrat.js +3 -13
  40. package/dist/temporal/places/contrat.js.map +1 -1
  41. package/dist/temporal/places/deroule.js +11 -61
  42. package/dist/temporal/places/deroule.js.map +1 -1
  43. package/dist/temporal/tickets/activites.js +4 -2
  44. package/dist/temporal/tickets/activites.js.map +1 -1
  45. package/dist/temporal/tickets/contrat.d.ts +2 -1
  46. package/docs/ARCHITECTURE.md +310 -115
  47. package/docs/CADRE.md +16 -13
  48. package/docs/INTERFACE.md +90 -25
  49. package/hooks/hooks.json +9 -0
  50. package/hooks/register.tsx +59 -5
  51. package/package.json +1 -1
  52. package/scripts/activites.mjs +271 -42
  53. package/scripts/aiguillage.mjs +4 -1
  54. package/scripts/bilan.mjs +125 -2
  55. package/scripts/circuit.mjs +233 -159
  56. package/scripts/circuits-cles.d.mts +3 -3
  57. package/scripts/circuits-cles.mjs +6 -5
  58. package/scripts/coeurs-dedies.mjs +4 -4
  59. package/scripts/commandes-composees.mjs +12 -5
  60. package/scripts/dette.d.ts +2 -1
  61. package/scripts/dette.mjs +49 -6
  62. package/scripts/direct.mjs +343 -0
  63. package/scripts/droits.mjs +19 -0
  64. package/scripts/effets.mjs +4 -4
  65. package/scripts/engendres.mjs +2 -1
  66. package/scripts/enveloppe/enveloppe.mjs +67 -13
  67. package/scripts/enveloppe/lancer.sh +14 -3
  68. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  69. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  70. package/scripts/etapes.mjs +3 -3
  71. package/scripts/faits-du-circuit.mjs +12 -11
  72. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  73. package/scripts/fermeture-de-la-machine.mjs +10 -20
  74. package/scripts/fichiers-nommes.mjs +27 -1
  75. package/scripts/file-des-tickets.d.mts +18 -1
  76. package/scripts/file-des-tickets.mjs +63 -15
  77. package/scripts/grillhouse-maj.mjs +13 -25
  78. package/scripts/groupe-cles.d.mts +6 -0
  79. package/scripts/groupe-cles.mjs +29 -1
  80. package/scripts/integration/file.mjs +148 -37
  81. package/scripts/jointure.d.ts +17 -3
  82. package/scripts/journal-des-etats.d.mts +16 -0
  83. package/scripts/journal-des-etats.mjs +44 -2
  84. package/scripts/journal.mjs +3 -0
  85. package/scripts/langages/c/commandes.mjs +5 -5
  86. package/scripts/langages/c/composants.mjs +13 -5
  87. package/scripts/langages/cargo/commandes.mjs +5 -6
  88. package/scripts/langages/python/commandes.mjs +5 -5
  89. package/scripts/langages/python/composants.mjs +10 -2
  90. package/scripts/langages/typescript/composants.mjs +10 -3
  91. package/scripts/langages/typescript/construire.mjs +2 -0
  92. package/scripts/langages/typescript/exemples.mjs +33 -1
  93. package/scripts/langages/typescript/index.mjs +19 -0
  94. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  95. package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
  96. package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
  97. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  98. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  99. package/scripts/langages/typescript/verifier.mjs +3 -5
  100. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  101. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  102. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  103. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  104. package/scripts/machine.mjs +1 -1
  105. package/scripts/mesure/base-de-passe.mjs +2 -1
  106. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  107. package/scripts/migrations.mjs +2 -0
  108. package/scripts/nuit.sh +97 -2
  109. package/scripts/paquet.mjs +16 -5
  110. package/scripts/paquets.d.ts +4 -0
  111. package/scripts/paquets.mjs +57 -0
  112. package/scripts/passe-de-la-machine.mjs +4 -7
  113. package/scripts/places-de-la-machine.mjs +55 -42
  114. package/scripts/places-du-serveur.mjs +2 -2
  115. package/scripts/plafond-de-la-machine.d.mts +7 -13
  116. package/scripts/plafond-de-la-machine.mjs +19 -35
  117. package/scripts/prefixe-des-tickets.mjs +1 -1
  118. package/scripts/references-changees.mjs +159 -0
  119. package/scripts/regles-des-places.d.mts +8 -31
  120. package/scripts/regles-des-places.mjs +14 -64
  121. package/scripts/repli-de-la-nuit.mjs +112 -0
  122. package/scripts/reponses-du-circuit.d.mts +2 -2
  123. package/scripts/reponses-du-circuit.mjs +21 -12
  124. package/scripts/reprise.mjs +27 -8
  125. package/scripts/resultats.mjs +21 -9
  126. package/scripts/seances.mjs +258 -40
  127. package/scripts/services-du-noyau.mjs +3 -0
  128. package/scripts/sous-commandes.mjs +24 -7
  129. package/scripts/superviseur.mjs +185 -39
  130. package/scripts/tableau.mjs +220 -89
  131. package/scripts/taches-du-graphe.mjs +84 -4
  132. package/scripts/ticket.mjs +345 -0
  133. package/scripts/transitions.d.mts +44 -0
  134. package/scripts/transitions.mjs +173 -13
  135. package/scripts/un-commit-par-ticket.mjs +4 -3
  136. package/scripts/verdict-de-la-nuit.mjs +47 -20
  137. package/scripts/verrou-de-fichier.mjs +2 -2
  138. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  139. package/scripts/verrous/verrou.mjs +17 -1
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/direct/SKILL.md +57 -0
  142. package/skills/explorateur/SKILL.md +10 -6
  143. package/skills/pitmaster/SKILL.md +34 -14
  144. package/skills/pitmaster/references/consigne-agent.md +7 -1
  145. package/skills/relecteur/SKILL.md +8 -0
  146. package/skills/testwriter/SKILL.md +10 -0
  147. package/scripts/ticket.sh +0 -25
@@ -22,12 +22,14 @@
22
22
  // above its debt, or absent from the debt with a title counted, is refused by its name; a debt
23
23
  // above the real count is refused too, so that the lot lowers it by `npm run
24
24
  // grillhouse:dette:elaguer`. A test file moved or renamed by the lot, its content kept (or
25
- // nearly), takes the debt of its former name (`renommesDuLot`).
25
+ // nearly), takes the debt of its former name (`renommesDuLot`). In the envelope of a plan, a debt
26
+ // above its count is judged in the files of the plan's packages alone (`mesureDuPlan` of
27
+ // ../../dette.mjs); the final pass judges the others.
26
28
  import { spawnSync } from 'node:child_process';
27
29
  import { readFileSync, writeFileSync } from 'node:fs';
28
30
  import path from 'node:path';
29
31
  import { pathToFileURL } from 'node:url';
30
- import { FICHIER, lire as lireDette, trancher } from '../../dette.mjs';
32
+ import { FICHIER, lire as lireDette, mesureDuPlan, trancher } from '../../dette.mjs';
31
33
  import { A_ELAGUER, ecrireSarif } from '../../resultats.mjs';
32
34
  import { prefixe } from '../../services-du-noyau.mjs';
33
35
  import { testsDuDepot } from './tailles-des-tests.mjs';
@@ -206,9 +208,11 @@ export function renommesDuLot(racine) {
206
208
  * The refusals of the findings <constats> against the <dette> read from the file: one
207
209
  * `{ fichier, message }` per file whose count rises above its debt (a file absent from the debt
208
210
  * has none) and per file whose debt stays above its count. <renommes> (`{ nouveau: ancien }`)
209
- * gives a file moved or renamed the debt of its former name.
211
+ * gives a file moved or renamed the debt of its former name. <mesure> says whether the run
212
+ * measures a file for the debt (`mesureDuPlan` of ../../dette.mjs; every file by default): a debt
213
+ * above its count is judged among those files alone.
210
214
  */
211
- export function jugerLesTitres(dette, constats, renommes = {}) {
215
+ export function jugerLesTitres(dette, constats, renommes = {}, mesure = () => true) {
212
216
  const inscrite = dette?.[GARDE] ?? {};
213
217
  const permis = f => inscrite[f]?.[REGLE]?.count ?? 0;
214
218
  const comptes = new Map();
@@ -225,7 +229,7 @@ export function jugerLesTitres(dette, constats, renommes = {}) {
225
229
  regle: REGLE,
226
230
  message: `${fichier} : ${trouve} titre(s) nomment un ticket ou un « critère N » pour ${droit} inscrit(s) dans ${FICHIER} : ${MESSAGE_FIN}`,
227
231
  });
228
- } else if (trouve < droit) {
232
+ } else if (trouve < droit && mesure(fichier)) {
229
233
  refus.push({
230
234
  fichier,
231
235
  regle: REGLE,
@@ -236,7 +240,7 @@ export function jugerLesTitres(dette, constats, renommes = {}) {
236
240
  }
237
241
  }
238
242
  for (const fichier of Object.keys(inscrite)) {
239
- if (comptes.has(fichier) || reprises.has(fichier) || !permis(fichier)) {
243
+ if (comptes.has(fichier) || reprises.has(fichier) || !permis(fichier) || !mesure(fichier)) {
240
244
  continue;
241
245
  }
242
246
  refus.push({
@@ -282,7 +286,7 @@ function main() {
282
286
  refus = r.refus;
283
287
  lignes = r.lignes;
284
288
  } else {
285
- refus = jugerLesTitres(lireDette(racine), constats, renommes);
289
+ refus = jugerLesTitres(lireDette(racine), constats, renommes, mesureDuPlan(racine));
286
290
  // Each refusal is a finding in SARIF; a debt above the count is also a note `a-elaguer`, by
287
291
  // which the circuit lowers the debt d'office.
288
292
  ecrireSarif({
@@ -155,7 +155,8 @@
155
155
  // (`TMPDIR`), the base of a pass (scripts/mesure/base-de-passe.mjs), where every task writes
156
156
  // its temporary files and which goes at the end of the pass; the workers of the tests of a task
157
157
  // (`GRILLHOUSE_TRAVAILLEURS`, scripts/places-de-la-machine.mjs), the bound a session or a pass
158
- // sets, which the tool of each language reads. The generator adds each
158
+ // sets, which the tool of each language reads; the Rust toolchain of a runner (`CARGO_HOME`,
159
+ // `RUSTUP_HOME`), which a runner of the repository holds per executor. The generator adds each
159
160
  // one the root lacks, the project's entries kept, and the check refuses a
160
161
  // root without one.
161
162
  //
@@ -182,7 +183,11 @@ import { lecturesDeclarees, testsDuPaquet } from './vitest-config/lances.mjs';
182
183
  import { parcourir } from './parcours.mjs';
183
184
  import { paquets, TYPAGE } from '../../paquets.mjs';
184
185
  import { ecrireSarif, RESULTATS } from '../../resultats.mjs';
185
- import { SCRIPT_DES_TESTS as TESTS, TESTS_CIBLES } from '../../services-du-noyau.mjs';
186
+ import {
187
+ SCRIPT_DES_TESTS as TESTS,
188
+ SCRIPTS_DE_GARDES,
189
+ TESTS_CIBLES,
190
+ } from '../../services-du-noyau.mjs';
186
191
 
187
192
  export const TURBO = 'turbo.json';
188
193
  export const COMMANDE = 'npx grillhouse turbo-des-paquets --ecrire';
@@ -193,7 +198,7 @@ const TOPOLOGIE = ['dependencies', 'devDependencies', 'optionalDependencies'];
193
198
  // The root configuration of Turborepo, in the order Turborepo reads it.
194
199
  const RACINES = ['turbo.json', 'turbo.jsonc'];
195
200
  // The guard tasks of the root: the frame's controls, and the project's own guards.
196
- export const GARDES = ['grillhouse:gardes', 'gardes'];
201
+ export const GARDES = SCRIPTS_DE_GARDES;
197
202
  // The controls of the root the CI used to play beside the verification: the format check and the
198
203
  // lint (grillhouse-61z). A root plays those its package.json holds a script for, none demanded.
199
204
  export const CONTROLES = ['format:check', 'lint'];
@@ -315,8 +320,20 @@ const attenteDuTypage = racine => (paquets(racine).length ? ['build', '^build']
315
320
  // The temporary directory of a process, which names the base of its pass.
316
321
  const TEMPORAIRE = 'TMPDIR';
317
322
  // The variables the root's `globalPassThroughEnv` names, and why, as the check says it.
318
- const PASSAGES = [RESULTATS, CHANGEMENTS, AVANCEMENT, TEMPORAIRE, TRAVAILLEURS];
323
+ const PASSAGES = [
324
+ RESULTATS,
325
+ CHANGEMENTS,
326
+ AVANCEMENT,
327
+ TEMPORAIRE,
328
+ TRAVAILLEURS,
329
+ 'CARGO_HOME',
330
+ 'RUSTUP_HOME',
331
+ ];
319
332
  const POURQUOI = {
333
+ CARGO_HOME:
334
+ "le CARGO_HOME de l'exécuteur, que cargo lit pour trouver sa chaîne ; sans lui un exécuteur à chaîne propre échoue",
335
+ RUSTUP_HOME:
336
+ "le RUSTUP_HOME de l'exécuteur, que rustup lit pour choisir une version de cargo ; sans lui un exécuteur à chaîne propre échoue",
320
337
  [RESULTATS]: "où les gardes, Turborepo et Vitest écrivent les résultats qu'un circuit lit",
321
338
  [CHANGEMENTS]:
322
339
  'les fichiers changés depuis le dernier vert, auxquels Vitest relie les tests que rejoue un paquet',
@@ -43,7 +43,7 @@
43
43
  // `turbo run grillhouse:gardes gardes typecheck test:unit --continue=dependencies-successful
44
44
  // --concurrency=<n> --summarize`, each argument given after it. A red does not stop the pass:
45
45
  // every task whose prerequisites passed plays, and each red is named. <n>, the tasks side by
46
- // side, is half the cores of the pass's part, one at least (`concurrence`): each task of tests is
46
+ // side, is half the cores of the pass's part, one at least (`tachesCoteACote` of the core): each task of tests is
47
47
  // itself parallel (Vitest's workers), as make's `-j` and Bazel's `--local_cpu_resources` bound a
48
48
  // build by the machine; a `--concurrency` among the arguments replaces it. The workers of each
49
49
  // task of tests are the cores shared between the tasks of tests side by side
@@ -136,6 +136,8 @@ import {
136
136
  PASSE_ROUGE,
137
137
  retirerALInterruption,
138
138
  SCRIPT_DES_TESTS,
139
+ SCRIPTS_DE_GARDES as GARDES,
140
+ tachesCoteACote as concurrence,
139
141
  TESTS_CIBLES,
140
142
  testsCibles,
141
143
  travailleursDeLaSeance,
@@ -147,7 +149,6 @@ import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
147
149
  import { garderLesResumes } from './resume-du-lanceur.mjs';
148
150
  import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
149
151
 
150
- const GARDES = ['grillhouse:gardes', 'gardes'];
151
152
  const TACHES = [...GARDES, TYPAGE, SCRIPT_DES_TESTS];
152
153
  const CONCURRENCE = /^--concurrency(?:=|$)/;
153
154
  // The variable that names the file of the red tasks, which the night reads.
@@ -161,9 +162,6 @@ const rejeu = id => {
161
162
 
162
163
  const lister = dossier => (existsSync(dossier) ? readdirSync(dossier) : []);
163
164
 
164
- // The tasks a pass plays side by side on a machine of <coeurs> cores: half of them, one at least.
165
- const concurrence = (coeurs = availableParallelism()) => Math.max(1, Math.floor(coeurs / 2));
166
-
167
165
  // The tasks side by side <args> ask for (`--concurrency=<n>`, `--concurrency <n>`), null without
168
166
  // a whole number.
169
167
  function concurrenceDemandee(args) {
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env node
2
+ // The lock of the dependencies (package-lock.json) against the package.json it locks, on the model
3
+ // of `npm ci`, which refuses a lock out of step with its package.json: the lock is written by the
4
+ // frame at the integration (`fichiersEngendres` of ./index.mjs), and this guard refuses a copy
5
+ // whose lock is late.
6
+ //
7
+ // npx grillhouse verrou-des-dependances run from the repository root (a guard of grillhouse:gardes)
8
+ //
9
+ // - For each package.json of the repository (the root's, and each workspace's), its `dependencies`,
10
+ // `devDependencies`, `optionalDependencies` and `peerDependencies` are compared with the entry of
11
+ // its package in the `packages` key of the lock (`""` for the root), without the registry and
12
+ // whatever the version of npm: a declared dependency absent from the lock, a dependency removed
13
+ // from the package.json still in the lock's entry, a range that differs from the entry's, a
14
+ // resolved version of the lock that no longer satisfies the declared range.
15
+ // - A finding is `{ fichier, message }`, one per package and dependency, the message naming the
16
+ // command that writes the lock again (COMMANDE). A repository without a lock is not judged, nor
17
+ // one whose project declares package-lock.json in `grillhouse.engendres` (its command is its own).
18
+ // - This module's top level uses Node alone: ./index.mjs imports it for the command, and the write
19
+ // lock of a session loads that module where the package's dependencies may not be installed.
20
+ // semver is required when the guard compares (`verifierLesConstats`), as ./mise-a-jour.mjs does.
21
+ import { existsSync, readFileSync, readdirSync } from 'node:fs';
22
+ import { createRequire } from 'node:module';
23
+ import path from 'node:path';
24
+ import { pathToFileURL } from 'node:url';
25
+ import { ecrireSarif } from '../../resultats.mjs';
26
+
27
+ export const GARDE = 'verrou-des-dependances';
28
+ export const COMMANDE = 'npm install --package-lock-only --no-audit --no-fund';
29
+
30
+ const SORTES = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
31
+ const LOCK = 'package-lock.json';
32
+
33
+ const lireJson = f => {
34
+ try {
35
+ return JSON.parse(readFileSync(f, 'utf8'));
36
+ } catch {
37
+ return null;
38
+ }
39
+ };
40
+
41
+ // The directories (from <racine>) the workspaces of the root package.json name: a literal path, or
42
+ // `<dossier>/*`.
43
+ function espaces(racine, manifeste) {
44
+ const motifs = Array.isArray(manifeste?.workspaces)
45
+ ? manifeste.workspaces
46
+ : (manifeste?.workspaces?.packages ?? []);
47
+ const dossiers = [];
48
+ for (const m of motifs.filter(x => typeof x === 'string')) {
49
+ const motif = m.replace(/^\.\//, '').replace(/\/+$/, '');
50
+ if (motif.endsWith('/*')) {
51
+ const parent = motif.slice(0, -2);
52
+ const lus = existsSync(path.join(racine, parent))
53
+ ? readdirSync(path.join(racine, parent), { withFileTypes: true })
54
+ : [];
55
+ dossiers.push(...lus.filter(e => e.isDirectory()).map(e => `${parent}/${e.name}`));
56
+ } else if (!motif.includes('*')) {
57
+ dossiers.push(motif);
58
+ }
59
+ }
60
+ return dossiers.filter(d => existsSync(path.join(racine, d, 'package.json')));
61
+ }
62
+
63
+ // The version the lock resolves <nom> to for the entry <cle>: the nearest `node_modules/<nom>`,
64
+ // following the link of a package of the repository; null when the lock holds none.
65
+ function resolue(packages, cle, nom) {
66
+ const candidats = [];
67
+ let c = cle;
68
+ for (;;) {
69
+ candidats.push(c ? `${c}/node_modules/${nom}` : `node_modules/${nom}`);
70
+ if (!c) {
71
+ break;
72
+ }
73
+ const i = c.lastIndexOf('/node_modules/');
74
+ c = i === -1 ? '' : c.slice(0, i);
75
+ }
76
+ const trouve = candidats.map(c => packages[c]).find(Boolean);
77
+ if (!trouve) {
78
+ return null;
79
+ }
80
+ const cible = trouve.link && trouve.resolved ? packages[trouve.resolved] : trouve;
81
+ return typeof cible?.version === 'string' ? cible.version : null;
82
+ }
83
+
84
+ /**
85
+ * The findings of the repository at <racine>: `[{ fichier, message }]`, one per package and
86
+ * dependency whose lock entry is out of step with its package.json.
87
+ * @param {string} racine
88
+ * @returns {{ fichier: string, message: string }[]}
89
+ */
90
+ export function verifierLesConstats(racine) {
91
+ const verrou = lireJson(path.join(racine, LOCK));
92
+ const racineManifeste = lireJson(path.join(racine, 'package.json'));
93
+ if (!verrou || typeof verrou.packages !== 'object' || !racineManifeste) {
94
+ return [];
95
+ }
96
+ // semver, required when the guard compares, not when the module loads (see the header).
97
+ const semver = createRequire(import.meta.url)('semver');
98
+ const packages = verrou.packages;
99
+ const cles = ['', ...espaces(racine, racineManifeste)];
100
+ const constats = [];
101
+ for (const cle of cles) {
102
+ const fichier = cle ? `${cle}/package.json` : 'package.json';
103
+ const manifeste = cle ? lireJson(path.join(racine, fichier)) : racineManifeste;
104
+ const entree = packages[cle] ?? {};
105
+ const dit = (nom, raison) =>
106
+ constats.push({
107
+ fichier,
108
+ message: `${cle || 'package.json'} : la dépendance ${nom} ${raison} ; \`${COMMANDE}\` réécrit le verrou.`,
109
+ });
110
+ for (const sorte of SORTES) {
111
+ const declare = manifeste?.[sorte] ?? {};
112
+ const verrouille = entree[sorte] ?? {};
113
+ for (const [nom, plage] of Object.entries(declare)) {
114
+ if (!(nom in verrouille)) {
115
+ dit(nom, `(${sorte}, ${plage}) est absente de l'entrée du verrou`);
116
+ } else if (verrouille[nom] !== plage) {
117
+ dit(
118
+ nom,
119
+ `(${sorte}) déclare ${plage} dans le package.json et ${verrouille[nom]} dans le verrou`
120
+ );
121
+ } else {
122
+ const version = resolue(packages, cle, nom);
123
+ if (version && semver.validRange(plage) && !semver.satisfies(version, plage)) {
124
+ dit(
125
+ nom,
126
+ `(${sorte}) déclare ${plage}, que la version ${version} du verrou ne satisfait pas`
127
+ );
128
+ }
129
+ }
130
+ }
131
+ for (const nom of Object.keys(verrouille)) {
132
+ if (!(nom in declare)) {
133
+ dit(nom, `(${sorte}) est retirée du package.json et reste dans l'entrée du verrou`);
134
+ }
135
+ }
136
+ }
137
+ }
138
+ return constats;
139
+ }
140
+
141
+ /**
142
+ * The refusals of the repository at <racine>, one line per package and dependency.
143
+ * @param {string} racine
144
+ * @returns {string[]}
145
+ */
146
+ export const verifier = racine => verifierLesConstats(racine).map(c => c.message);
147
+
148
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
149
+ const racine = process.cwd();
150
+ // A project that declares the lock a generated file (`grillhouse.engendres`) keeps its command,
151
+ // and its own judgement of it: the guard does not play for it.
152
+ const duProjet = Object.values(
153
+ lireJson(path.join(racine, 'package.json'))?.grillhouse?.engendres ?? {}
154
+ ).some(e => Array.isArray(e?.fichiers) && e.fichiers.includes(LOCK));
155
+ const constats = duProjet ? [] : verifierLesConstats(racine);
156
+ for (const c of constats) {
157
+ process.stderr.write(`⛔ ${c.message}\n`);
158
+ }
159
+ ecrireSarif({ garde: GARDE, racine, constats });
160
+ process.exitCode = constats.length ? 1 : 0;
161
+ }
@@ -73,6 +73,13 @@ export const NUIT_VARIABLE = 'GRILLHOUSE_TESTS_DE_NUIT';
73
73
  * `i/n`, and `rapports`, the directory of its reports (`trancher`, ../tranches.mjs).
74
74
  */
75
75
  export const NUIT_TRANCHE = 'GRILLHOUSE_TRANCHE_DE_NUIT';
76
+ /**
77
+ * The variable that carries the unit of a run of the night's configuration, JSON: `config`, the
78
+ * configuration of the package of the run (absent for the root), and `exclus`, the patterns of
79
+ * the units below it, which it leaves out. The night's configuration takes it out of the environment
80
+ * once read: no process the tests start receives it.
81
+ */
82
+ export const NUIT_PAQUET = 'GRILLHOUSE_NUIT_PAQUET';
76
83
  // Whether the file at <fichier> bears the name of <motif>, a globstar then a name: by the name of
77
84
  // the file, since a globstar passes no directory whose name starts with a dot, and a ticket's copy
78
85
  // lives under `.claude/worktrees/`.
@@ -106,6 +113,26 @@ export function porteLEtiquetteDuPoste(texte) {
106
113
  }
107
114
  return false;
108
115
  }
116
+ // The tag of a night test that needs the equipment of a machine (the envelope, a Temporal server,
117
+ // the binaries of the module cargo): `// @equipee: <reason>` in the comment at the head of the file,
118
+ // beside `@poste` when the test needs both. A runner without equipment leaves it out.
119
+ const ETIQUETTE_EQUIPEE = /^\/\/\s*@equipee\b/;
120
+ /**
121
+ * Whether the text <texte> of a test file bears the tag `@equipee` in the comment at its head.
122
+ * @param {string} texte the text of the file
123
+ */
124
+ export function porteLEtiquetteEquipee(texte) {
125
+ for (const ligne of texte.split('\n')) {
126
+ const l = ligne.trim();
127
+ if (ETIQUETTE_EQUIPEE.test(l)) {
128
+ return true;
129
+ }
130
+ if (l !== '' && !l.startsWith('//') && !l.startsWith('#!')) {
131
+ return false;
132
+ }
133
+ }
134
+ return false;
135
+ }
109
136
  // Vitest's default `include` (its configDefaults).
110
137
  const INCLUDE = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
111
138
  // The mark of a time witness: the import of `mesurerAuRepos`, on a line of its own, from the
@@ -289,6 +316,18 @@ async function cibler(config, test, valeur, temoins) {
289
316
  * @param {string} dir the directory searched
290
317
  */
291
318
  export function testsDuPoste(dir) {
319
+ return testsEtiquetes(dir, porteLEtiquetteDuPoste);
320
+ }
321
+
322
+ /**
323
+ * The night tests under <dir> that bear the tag `@equipee`, listed as `testsDuPoste` lists its own.
324
+ * @param {string} dir the directory searched
325
+ */
326
+ export function testsEquipes(dir) {
327
+ return testsEtiquetes(dir, porteLEtiquetteEquipee);
328
+ }
329
+
330
+ function testsEtiquetes(dir, porte) {
292
331
  return [
293
332
  ...new Set(
294
333
  globSync([NUIT], { cwd: dir, exclude: d => HORS_TEMOINS.has(path.basename(d)) }).map(f =>
@@ -296,14 +335,16 @@ export function testsDuPoste(dir) {
296
335
  )
297
336
  ),
298
337
  ]
299
- .filter(f => porteLEtiquetteDuPoste(lireTexte(path.join(dir, f))))
338
+ .filter(f => porte(lireTexte(path.join(dir, f))))
300
339
  .sort();
301
340
  }
302
341
 
303
342
  /**
304
343
  * The plugin of the night's configuration: the night tests, the benches and the time witnesses
305
344
  * under its directory, or, as <env> chooses in NUIT_VARIABLE, the night tests alone (`nuit`), the
306
- * night tests but those tagged `@poste` (`hors-poste`, the night of a shared machine: a CI), or the
345
+ * night tests but those tagged `@poste` (`hors-poste`, the night of an equipped runner), those
346
+ * tagged `@poste` or `@equipee` left out too (`hors-poste-sans-equipement`), those tagged `@poste`
347
+ * alone (`du-poste`, the night of the poste), or the
307
348
  * measures alone (`mesures`), the benches and the witnesses; every choice plays one file at a time
308
349
  * (`fileParallelism: false`), the night at rest; with NUIT_TRANCHE, the tranche it carries of these
309
350
  * files.
@@ -324,15 +365,25 @@ export const nuit = (env = process.env) => ({
324
365
  test.fileParallelism = false;
325
366
  if (choix === 'nuit') {
326
367
  test.include = [NUIT];
327
- } else if (choix === 'hors-poste') {
368
+ } else if (choix === 'hors-poste' || choix === 'hors-poste-sans-equipement') {
328
369
  test.include = [NUIT];
329
- const duPoste = testsDuPoste(path.resolve(config.root ?? process.cwd(), test.dir ?? ''));
330
- if (duPoste.length) {
370
+ const dir = path.resolve(config.root ?? process.cwd(), test.dir ?? '');
371
+ const laisses = [
372
+ ...new Set([
373
+ ...testsDuPoste(dir),
374
+ ...(choix === 'hors-poste-sans-equipement' ? testsEquipes(dir) : []),
375
+ ]),
376
+ ].sort();
377
+ if (laisses.length) {
331
378
  test.exclude = [
332
379
  ...(test.exclude ?? ['**/node_modules/**']),
333
- ...duPoste.map(r => r.replace(SPECIAUX, '\\$&')),
380
+ ...laisses.map(r => r.replace(SPECIAUX, '\\$&')),
334
381
  ];
335
382
  }
383
+ } else if (choix === 'du-poste') {
384
+ test.include = testsDuPoste(path.resolve(config.root ?? process.cwd(), test.dir ?? '')).map(
385
+ r => r.replace(SPECIAUX, '\\$&')
386
+ );
336
387
  } else if (choix === 'mesures') {
337
388
  test.include = [BUDGET, ...temoins];
338
389
  } else {
@@ -3,7 +3,10 @@
3
3
  // the temporary directory named after its process and a token, scripts/places-de-la-machine.mjs),
4
4
  // which every process it starts inherits: a `npm run verifier` or a circuit that a test plays in
5
5
  // a repository of trial takes its part there, among its own parts alone, and no test writes in the
6
- // user's state. A directory already named in the environment stays. Its passes want no room in
6
+ // user's state. A directory already named in the environment stays. The directory the file named
7
+ // is removed at its end, with what a pass left there (the part of a pass a test killed, which
8
+ // never gave it back), as the register of the file is (./registre.setup.mjs): the guard of the
9
+ // temporary directory of the run finds nothing of it. Its passes want no room in
7
10
  // the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0) nor on the disk of their copy
8
11
  // (GRILLHOUSE_COPIE_LIBRE, 0): the room of the machine is the pass's that plays the file, which
9
12
  // waited for it.
@@ -11,13 +14,16 @@
11
14
  // That trial machine takes no place of the user's machine (scripts/places-de-la-machine.mjs): only
12
15
  // the server of trial a test names (GRILLHOUSE_PLACES_D_ESSAI).
13
16
  import { randomUUID } from 'node:crypto';
17
+ import { rmSync } from 'node:fs';
14
18
  import { tmpdir } from 'node:os';
15
19
  import path from 'node:path';
20
+ import { afterAll } from 'vitest';
16
21
 
17
- process.env.GRILLHOUSE_PARTS_DE_LA_MACHINE ||= path.join(
18
- tmpdir(),
19
- `grillhouse-parts-${process.pid}-${randomUUID()}`
20
- );
22
+ if (!process.env.GRILLHOUSE_PARTS_DE_LA_MACHINE) {
23
+ const parts = path.join(tmpdir(), `grillhouse-parts-${process.pid}-${randomUUID()}`);
24
+ process.env.GRILLHOUSE_PARTS_DE_LA_MACHINE = parts;
25
+ afterAll(() => rmSync(parts, { recursive: true, force: true }));
26
+ }
21
27
  // The machine a test reads is a fixed one (GRILLHOUSE_MESURE_D_ESSAI, scripts/places-de-la-machine.mjs
22
28
  // `etatDesPlaces`): no test reads the real load or memory of the user's machine.
23
29
  process.env.GRILLHOUSE_MESURE_D_ESSAI ||= JSON.stringify({
@@ -10,17 +10,50 @@
10
10
  // and the benches, and its plugin adds the witnesses under the root, or chooses the night tests
11
11
  // alone, the night tests but those tagged `@poste` (the night of a shared machine, a CI), or the
12
12
  // measures alone, one file at a time (`nuit` of ./vitest-config/cibles.mjs, the variable
13
- // GRILLHOUSE_TESTS_DE_NUIT). It reads no day configuration of the project, whether the
14
- // project has one at its root or one per package; it takes from the base configuration the common
13
+ // GRILLHOUSE_TESTS_DE_NUIT). It reads no day configuration of the root, and that of each package
14
+ // only for its own files (below); it takes from the base configuration the common
15
15
  // environment (git's settings) and the measure of time: the setup file that notes the CPU pressure
16
16
  // of each test and the duration reporter, which gives 75, « à repasser », to a measure that fails
17
17
  // under load (scripts/langages/typescript/vitest-config/duree.reporter.mjs).
18
+ //
19
+ // A run plays one unit of the project: the root, under this configuration alone, or a package that
20
+ // has a Vitest configuration (`vitest.config.*`, else `vite.config.*`, in its directory, found by
21
+ // ./tests-de-nuit.mjs), under this configuration merged over the package's, as Vitest's projects
22
+ // merge a package's configuration with the root's: what the package sets and the night does not
23
+ // set (environment, alias, plugins) stays, its setup files precede those of the base, and what the
24
+ // night sets wins (include, exclusions, reporters, delays, one file at a time, the tranche). The
25
+ // variable GRILLHOUSE_NUIT_PAQUET (NUIT_PAQUET), JSON, names the configuration of the package of
26
+ // the run (`config`) and the directories of the units below the unit of the run (`exclus`), which
27
+ // it leaves out; this configuration takes it out of the environment once read, as the plugin of
28
+ // the night does its choice and its tranche: the unit is the run's own, and a Vitest that a night
29
+ // test starts itself, in another package, plays under no configuration but its own. Node (>= 26)
30
+ // reads the package's configuration itself, TypeScript included; a configuration written as a
31
+ // function is called as Vite calls it, for a test run.
32
+ import { pathToFileURL } from 'node:url';
33
+ import { mergeConfig } from 'vitest/config';
18
34
  import base from './vitest-config/base.mjs';
19
- import { HORS_DU_JOUR, nuit } from './vitest-config/cibles.mjs';
35
+ import { HORS_DU_JOUR, nuit, NUIT_PAQUET } from './vitest-config/cibles.mjs';
20
36
  import { DELAI_NUIT_MS } from './vitest-config/bornes.mjs';
21
37
 
22
- export default {
23
- plugins: [nuit()],
38
+ const { config: fichier, exclus = [] } = process.env[NUIT_PAQUET]
39
+ ? JSON.parse(process.env[NUIT_PAQUET])
40
+ : {};
41
+ delete process.env[NUIT_PAQUET];
42
+
43
+ // What the night sets wins over the configuration of a package, whose plugins have run first: the
44
+ // exclusions of its unit, the reporters, and the setup files, the package's before the base's.
45
+ const nuitGagne = {
46
+ name: 'grillhouse:nuit-gagne',
47
+ config(config) {
48
+ const test = (config.test ??= {});
49
+ test.exclude = ['**/node_modules/**', '**/dist/**', '**/.git/**', ...exclus];
50
+ test.reporters = base.test.reporters;
51
+ test.setupFiles = [...new Set([...(test.setupFiles ?? []), ...base.test.setupFiles])];
52
+ },
53
+ };
54
+
55
+ const cadre = {
56
+ plugins: [nuitGagne, nuit()],
24
57
  cacheDir: base.cacheDir,
25
58
  test: {
26
59
  env: base.test.env,
@@ -29,9 +62,24 @@ export default {
29
62
  setupFiles: base.test.setupFiles,
30
63
  include: HORS_DU_JOUR,
31
64
  exclude: ['**/node_modules/**', '**/dist/**', '**/.git/**'],
65
+ // A unit may hold none of the files the run chooses.
66
+ passWithNoTests: true,
32
67
  // The large delay of Bazel for a night test: 900 s (./vitest-config/delais.mjs).
33
68
  testTimeout: DELAI_NUIT_MS,
34
69
  hookTimeout: DELAI_NUIT_MS,
35
70
  watch: false,
36
71
  },
37
72
  };
73
+
74
+ async function dePaquet(f) {
75
+ const lu = (await import(pathToFileURL(f).href)).default;
76
+ const paquet = typeof lu === 'function' ? await lu({ command: 'serve', mode: 'test' }) : lu;
77
+ // The environment and the setup files of the package are its own to set.
78
+ const { environment: _e, setupFiles: _s, ...test } = cadre.test;
79
+ return mergeConfig(paquet ?? {}, { ...cadre, test });
80
+ }
81
+
82
+ /** @type {typeof cadre} */
83
+ const configuration = fichier ? await dePaquet(fichier) : cadre;
84
+
85
+ export default configuration;
@@ -76,7 +76,7 @@ export async function jouer(
76
76
  return prises.length + parts.length;
77
77
  };
78
78
  const restent = dit();
79
- if (!attendre || issue === 'nuit-tient') {
79
+ if (!attendre) {
80
80
  return 0;
81
81
  }
82
82
  let encore = restent;
@@ -15,7 +15,8 @@
15
15
  // (`globalPassThroughEnv`, scripts/langages/typescript/turbo-des-paquets.mjs); `circuit`, the results and progress
16
16
  // of the passes of a circuit's run (scripts/circuit.mjs; its working directory is the ticket's,
17
17
  // beside its copy, which no sweep touches); `integration`, the working directory of an
18
- // integration (scripts/integration/integrer.mjs); `enveloppe`, the throwaway state of a session's envelope
18
+ // integration (scripts/integration/integrer.mjs); `file`, the results of the final pass of the queue
19
+ // (scripts/integration/file.mjs); `enveloppe`, the throwaway state of a session's envelope
19
20
  // (scripts/enveloppe/enveloppe.mjs).
20
21
  // - The owner of a base is the process that opens it, for a pass and a session out of a ticket
21
22
  // (the night, a verification); a ticket (`ouvrirBaseDuTicket`: `<dans>/grillhouse-ticket-<id>/`,
@@ -0,0 +1,30 @@
1
+ // From 0.49.0 a circuit reserves 3 cores (it reserved 4). A package.json of the project whose
2
+ // `grillhouse.part.coeurs` is 4 gets 3, its other keys, its layout and its end of line kept; a
3
+ // project without that value, without `grillhouse` or without package.json is left, and a second
4
+ // pass changes nothing and says nothing.
5
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
6
+ import path from 'node:path';
7
+
8
+ export const version = '0.49.0';
9
+ export const nom = 'reservation de trois coeurs';
10
+
11
+ /** `grillhouse.part.coeurs` 4 turned into 3 in the package.json of <projet>; returns what it did. */
12
+ export function migrer(projet) {
13
+ const fichier = path.join(projet, 'package.json');
14
+ if (!existsSync(fichier)) {
15
+ return [];
16
+ }
17
+ const texte = readFileSync(fichier, 'utf8');
18
+ const pkg = JSON.parse(texte);
19
+ const part = pkg?.grillhouse?.part;
20
+ if (!part || typeof part !== 'object' || part.coeurs !== 4) {
21
+ return [];
22
+ }
23
+ part.coeurs = 3;
24
+ const indent = /^\n?(\s+)"/m.exec(texte)?.[1] ?? 2;
25
+ const fin = texte.endsWith('\n') ? '\n' : '';
26
+ writeFileSync(fichier, `${JSON.stringify(pkg, null, indent)}${fin}`);
27
+ return [
28
+ 'package.json : grillhouse.part.coeurs passe de 4 à 3, la réservation de cœurs d’un circuit ordinaire',
29
+ ];
30
+ }
@@ -44,6 +44,7 @@ import * as seuilDesCodesDeTickets from './migrations/0.44.0-seuil-des-codes-de-
44
44
  import * as ciDeMain from './migrations/0.47.0-ci-de-main.mjs';
45
45
  import * as pousseeRetiree from './migrations/0.48.0-poussee-retiree.mjs';
46
46
  import * as ciDeclencheeParLaFile from './migrations/0.48.0-ci-declenchee-par-la-file.mjs';
47
+ import * as reservationDeTroisCoeurs from './migrations/0.49.0-reservation-de-trois-coeurs.mjs';
47
48
 
48
49
  /** The migrations of the core. */
49
50
  export const MIGRATIONS = [
@@ -67,6 +68,7 @@ export const MIGRATIONS = [
67
68
  ciDeMain,
68
69
  pousseeRetiree,
69
70
  ciDeclencheeParLaFile,
71
+ reservationDeTroisCoeurs,
70
72
  ];
71
73
 
72
74
  /**