@roomi-fields/grillhouse 0.31.0 → 0.33.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 (149) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +40 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +136 -16
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
  6. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +8 -5
  9. package/dist/temporal/circuit/contrat.d.ts +15 -0
  10. package/dist/temporal/circuit/deroule.js +37 -14
  11. package/dist/temporal/circuit/deroule.js.map +1 -1
  12. package/dist/temporal/deroules.d.ts +1 -0
  13. package/dist/temporal/deroules.js +3 -1
  14. package/dist/temporal/deroules.js.map +1 -1
  15. package/dist/temporal/file/activites.d.ts +1 -0
  16. package/dist/temporal/file/activites.js +5 -2
  17. package/dist/temporal/file/activites.js.map +1 -1
  18. package/dist/temporal/file/contrat.d.ts +50 -33
  19. package/dist/temporal/file/contrat.js +2 -2
  20. package/dist/temporal/file/contrat.js.map +1 -1
  21. package/dist/temporal/file/deroule.d.ts +3 -1
  22. package/dist/temporal/file/deroule.js +128 -26
  23. package/dist/temporal/file/deroule.js.map +1 -1
  24. package/dist/temporal/installation.d.ts +3 -2
  25. package/dist/temporal/installation.js +7 -4
  26. package/dist/temporal/installation.js.map +1 -1
  27. package/dist/temporal/nuits/activites.d.ts +10 -0
  28. package/dist/temporal/nuits/activites.js +114 -0
  29. package/dist/temporal/nuits/activites.js.map +1 -0
  30. package/dist/temporal/nuits/appel.d.ts +23 -0
  31. package/dist/temporal/nuits/appel.js +40 -0
  32. package/dist/temporal/nuits/appel.js.map +1 -0
  33. package/dist/temporal/nuits/choix.d.ts +14 -0
  34. package/dist/temporal/nuits/choix.js +119 -0
  35. package/dist/temporal/nuits/choix.js.map +1 -0
  36. package/dist/temporal/nuits/client.d.ts +28 -0
  37. package/dist/temporal/nuits/client.js +83 -0
  38. package/dist/temporal/nuits/client.js.map +1 -0
  39. package/dist/temporal/nuits/commande.d.ts +2 -0
  40. package/dist/temporal/nuits/commande.js +107 -0
  41. package/dist/temporal/nuits/commande.js.map +1 -0
  42. package/dist/temporal/nuits/contrat.d.ts +98 -0
  43. package/dist/temporal/nuits/contrat.js +30 -0
  44. package/dist/temporal/nuits/contrat.js.map +1 -0
  45. package/dist/temporal/nuits/deroule.d.ts +5 -0
  46. package/dist/temporal/nuits/deroule.js +100 -0
  47. package/dist/temporal/nuits/deroule.js.map +1 -0
  48. package/dist/temporal/tickets/activites.d.ts +1 -0
  49. package/dist/temporal/tickets/activites.js +5 -0
  50. package/dist/temporal/tickets/activites.js.map +1 -1
  51. package/dist/temporal/tickets/contrat.d.ts +10 -0
  52. package/dist/temporal/tickets/deroule.js +8 -1
  53. package/dist/temporal/tickets/deroule.js.map +1 -1
  54. package/dist/temporal/travailleur.js +4 -1
  55. package/dist/temporal/travailleur.js.map +1 -1
  56. package/docs/ARCHITECTURE.md +257 -54
  57. package/docs/CADRE.md +41 -1
  58. package/docs/INTERFACE.md +54 -7
  59. package/hooks/hooks.json +4 -0
  60. package/hooks/register.tsx +11 -3
  61. package/package.json +4 -1
  62. package/scripts/abi-des-dependances.mjs +105 -0
  63. package/scripts/activites.mjs +99 -48
  64. package/scripts/aiguillage.mjs +3 -0
  65. package/scripts/attente-au-tour.mjs +99 -0
  66. package/scripts/avancement.mjs +8 -18
  67. package/scripts/base-des-workflows.mjs +57 -0
  68. package/scripts/ci-des-branches.mjs +91 -0
  69. package/scripts/circuit.mjs +99 -5
  70. package/scripts/composants-affectes.mjs +24 -7
  71. package/scripts/composition-des-langages.mjs +3 -0
  72. package/scripts/copies-finies.mjs +8 -1
  73. package/scripts/crochets.mjs +4 -0
  74. package/scripts/dernier-vert.mjs +30 -4
  75. package/scripts/effets.mjs +9 -0
  76. package/scripts/enveloppe/enveloppe.mjs +3 -1
  77. package/scripts/enveloppe/lancer.sh +1 -1
  78. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  79. package/scripts/etapes.mjs +19 -2
  80. package/scripts/faits-du-circuit.mjs +43 -20
  81. package/scripts/fichier-du-poste.mjs +87 -0
  82. package/scripts/grillhouse-maj.mjs +15 -1
  83. package/scripts/integration/file.mjs +215 -275
  84. package/scripts/integration/integrer.mjs +82 -41
  85. package/scripts/integration/rejeu.mjs +13 -64
  86. package/scripts/jointure.d.ts +30 -2
  87. package/scripts/journal-des-etats.d.mts +41 -0
  88. package/scripts/journal-des-etats.mjs +273 -0
  89. package/scripts/journal.mjs +119 -0
  90. package/scripts/langages/cargo/commandes.mjs +81 -19
  91. package/scripts/langages/cargo/exemples.mjs +2 -2
  92. package/scripts/langages/cargo/index.mjs +14 -5
  93. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  94. package/scripts/langages/python/commandes.mjs +11 -7
  95. package/scripts/langages/python/exemples.mjs +1 -1
  96. package/scripts/langages/python/index.mjs +11 -2
  97. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  98. package/scripts/langages/typescript/code-mort.mjs +41 -24
  99. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  100. package/scripts/langages/typescript/exemples.mjs +2 -0
  101. package/scripts/langages/typescript/frontieres.mjs +46 -0
  102. package/scripts/langages/typescript/index.mjs +24 -3
  103. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  104. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  105. package/scripts/langages/typescript/resumes.mjs +17 -7
  106. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  107. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  108. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  109. package/scripts/langages/typescript/tranches.mjs +273 -0
  110. package/scripts/langages/typescript/verifier.mjs +154 -23
  111. package/scripts/langages/typescript/vitest-config/base.mjs +3 -0
  112. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  113. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  114. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  115. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  116. package/scripts/langages.d.mts +20 -0
  117. package/scripts/lint-des-scripts.mjs +23 -6
  118. package/scripts/matiere-de-test.d.ts +11 -0
  119. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  120. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  121. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  122. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  123. package/scripts/migrations.mjs +8 -0
  124. package/scripts/newday.mjs +18 -0
  125. package/scripts/nuit.sh +40 -13
  126. package/scripts/places-de-la-machine.mjs +6 -0
  127. package/scripts/registre.d.mts +90 -0
  128. package/scripts/registre.mjs +28 -3
  129. package/scripts/reprise.mjs +12 -8
  130. package/scripts/services-du-noyau.mjs +4 -0
  131. package/scripts/session-start.sh +28 -32
  132. package/scripts/sous-commandes.mjs +31 -10
  133. package/scripts/superviseur.mjs +127 -75
  134. package/scripts/tableau.mjs +222 -17
  135. package/scripts/taches-du-graphe.mjs +39 -6
  136. package/scripts/ticket-du-circuit.mjs +37 -7
  137. package/scripts/transitions.mjs +60 -8
  138. package/scripts/verrou-de-machine.mjs +1 -2
  139. package/scripts/workflows-du-cadre.mjs +75 -0
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/explorateur/SKILL.md +1 -1
  142. package/skills/grill/SKILL.md +10 -62
  143. package/skills/grill/references/paquets.md +60 -0
  144. package/skills/pitmaster/SKILL.md +21 -31
  145. package/skills/questionneur/SKILL.md +1 -1
  146. package/skills/relecteur/SKILL.md +1 -1
  147. package/skills/testwriter/SKILL.md +7 -1
  148. package/skills/release/SKILL.md +0 -134
  149. package/skills/release/scripts/update-version.cjs +0 -92
@@ -17,10 +17,9 @@
17
17
  // (./composants.mjs).
18
18
  // - The elements of a lot, one per crate (./elements-du-lot.mjs).
19
19
  // - The commands `tester` (the crates' tasks of Turborepo), `tests-du-paquet` (the body of a crate's
20
- // task), `verifier`, `typer`, `preparer` and `tests-de-nuit` (./commandes.mjs),
21
- // each described, `{ script, args }`, never run, `preparer` played by the integration before the
22
- // verification, `tests-de-nuit` by the night (the test targets `tests/*_nuit.rs`, then the time
23
- // budget benches `tests/*_budget.rs`, which the day leaves out);
20
+ // task), `verifier`, `typer` and `tests-de-nuit` (./commandes.mjs), each described, `{ script,
21
+ // args }`, never run, `tests-de-nuit` played by the night (the test targets `tests/*_nuit.rs`,
22
+ // then the time budget benches `tests/*_budget.rs`, which the day leaves out);
24
23
  // the verdict of a run (./verdict.mjs). The tool of a test's temporary directory, the crate
25
24
  // `tempfile`, and its guard: `tests-du-paquet` and `verifier` play under a base of their pass, named in
26
25
  // TMPDIR, TMP and TEMP, and fail naming what the tests left there (./commandes.mjs).
@@ -38,7 +37,7 @@
38
37
  import { readFileSync } from 'node:fs';
39
38
  import path from 'node:path';
40
39
  import { fileURLToPath } from 'node:url';
41
- import { empreintesDesTaches } from '../../services-du-noyau.mjs';
40
+ import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
42
41
  import { commandes, fichierHorsDuJour, GARDES } from './commandes.mjs';
43
42
  import {
44
43
  composantDans,
@@ -77,6 +76,9 @@ export default {
77
76
  },
78
77
  // The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`).
79
78
  outils: ['smol-toml'],
79
+ // The programs the installer of Temporal requires in the PATH of the workers: cargo's folder is
80
+ // also rustc's, nextest's and sccache's (rustup, `cargo install`).
81
+ executables: ['cargo'],
80
82
  // The binaries the module runs, each at an exact version: nextest and cargo-deny at the ones the
81
83
  // probe of grillhouse-pkl.1 measured; sccache, the cache of compilation common to the copies
82
84
  // (./sccache.mjs), at the last release of mozilla/sccache, v0.19.0 (2026-10-24).
@@ -123,6 +125,13 @@ export default {
123
125
  elementsDuLot,
124
126
  // The hashes of the inputs of the tests tasks of the crates and their dependents, as
125
127
  // Turborepo plans them.
128
+ // The remote cache of Turborepo on the poste: its server, its team, its token and the key of its
129
+ // signature in ~/.config/grillhouse/turbo-cache.env, read alone, never written from the poste.
130
+ environnementDuPoste: env =>
131
+ avecLeFichierDuPoste(env, {
132
+ fichier: 'turbo-cache.env',
133
+ ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
134
+ }),
126
135
  empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
127
136
  commandes,
128
137
  verdict,
@@ -30,7 +30,7 @@
30
30
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
31
31
  import path from 'node:path';
32
32
  import { pathToFileURL } from 'node:url';
33
- import { trancher } from '../../dette.mjs';
33
+ import { MODE, trancher } from '../../dette.mjs';
34
34
  import { horsDuJour } from './commandes.mjs';
35
35
  import { crates, unitaire } from './composants.mjs';
36
36
 
@@ -177,19 +177,27 @@ export function verifier(racine) {
177
177
  }));
178
178
  }
179
179
 
180
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
181
- const racine = process.cwd();
180
+ // The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
181
+ // prefixed with `⛔`, then the debt's lines, then the count of each size), and `code`, its exit code
182
+ // (1 on a refusal). The functional core of the command: it reads the repository and the project's
183
+ // debt and writes nothing to the standard streams; the command below is its shell. The refusals
184
+ // reach SARIF through `trancher` under the results directory <env> names (scripts/resultats.mjs);
185
+ // without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
186
+ export function rapport(racine, env = process.env) {
182
187
  const toutes = tailles(racine);
183
188
  const compte = t => toutes.filter(x => x.taille === t).length;
184
- const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
185
- for (const r of refus) {
186
- process.stderr.write(`⛔ ${r.message}\n`);
187
- }
189
+ const { refus, lignes } = trancher(racine, GARDE, verifier(racine), env[MODE] || undefined, env);
190
+ const resume = `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit ou de banc.`;
191
+ return {
192
+ lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes, resume],
193
+ code: refus.length ? 1 : 0,
194
+ };
195
+ }
196
+
197
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
198
+ const { lignes, code } = rapport(process.cwd());
188
199
  for (const l of lignes) {
189
200
  process.stderr.write(`${l}\n`);
190
201
  }
191
- process.stderr.write(
192
- `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit ou de banc.\n`
193
- );
194
- process.exitCode = refus.length ? 1 : 0;
202
+ process.exitCode = code;
195
203
  }
@@ -7,7 +7,6 @@
7
7
  // npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
8
8
  // npx grillhouse verifier [--tout | --gardes] verifier
9
9
  // node commandes.mjs typer typer
10
- // npx grillhouse preparer preparer
11
10
  // npx grillhouse tests-de-nuit tests-de-nuit
12
11
  // npx grillhouse tailles-des-tests | index-interfaces each guard, its own script
13
12
  //
@@ -52,7 +51,7 @@
52
51
  // the guards alone: the project's root scripts `grillhouse:gardes` then `gardes` the package.json
53
52
  // holds.
54
53
  // - `typer`: `uv run --locked python -m compileall`, the folders whose name begins with a dot (the
55
- // `.venv`) left out. `preparer`: `uv sync --locked --group test`.
54
+ // `.venv`) left out.
56
55
  // - `tests-de-nuit`: pytest on the night tests of each package that holds some; none, nothing
57
56
  // plays and the code is 0. The night (scripts/nuit.sh) runs it.
58
57
  // - `construire --echec <fichier> <plan>` is the launcher's build of the copy
@@ -60,7 +59,7 @@
60
59
  // (`construireDepuisLesArguments` of scripts/taches-du-graphe.mjs): the plan and its providers by
61
60
  // `turbo run build --filter=<paquet>…`. `construire <chemin>` syncs one project, as the script
62
61
  // `build` of its package.
63
- // - `tests-du-paquet`, `tests-de-nuit`, `verifier`, `typer` and `preparer` play under a temporary
62
+ // - `tests-du-paquet`, `tests-de-nuit`, `verifier` and `typer` play under a temporary
64
63
  // directory of their pass, the guard of the temporary directory: a base (`ouvrirBase` of ./jointure) named in TMPDIR, TMP and TEMP, removed at the
65
64
  // end of the pass, green, red or interrupted; what the tests left there fails the pass (code 1),
66
65
  // each name written on the error stream, the lock files uv takes there (`uv-<hash>.lock`) apart,
@@ -94,6 +93,7 @@ import {
94
93
  cheminsDeLaTache,
95
94
  construireDepuisLesArguments,
96
95
  GRAPHE_JOUE,
96
+ joueCeQuiNeSeDivisePas,
97
97
  lancerLesTaches,
98
98
  ligneDesRestes,
99
99
  nomDuPaquet,
@@ -121,7 +121,6 @@ export const NOMS = [
121
121
  'verifier',
122
122
  'typer',
123
123
  'construire',
124
- 'preparer',
125
124
  'tests-de-nuit',
126
125
  ];
127
126
  // The task runner of the graph of the packages.
@@ -380,7 +379,7 @@ function testsDuPaquet(racine, args, env) {
380
379
  return 2;
381
380
  }
382
381
  const dossierDe = abs => composantDans(tous, racine, abs)?.dossier ?? null;
383
- const { chemins, options } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
382
+ const { chemins, options, tranche } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
384
383
  const r = choisir(racine, tous, chemins);
385
384
  if (r.refus) {
386
385
  for (const l of r.refus) {
@@ -388,6 +387,11 @@ function testsDuPaquet(racine, args, env) {
388
387
  }
389
388
  return 2;
390
389
  }
390
+ // pytest has no split of its own: a tranche past the first plays none of its tests, the first
391
+ // plays them all, so the n tranches together play each test once.
392
+ if (!joueCeQuiNeSeDivisePas(tranche)) {
393
+ return 0;
394
+ }
391
395
  const p = passe(racine, env);
392
396
  jouerLesTests(p, r.choix, [...args.filter(a => a.startsWith('-')), ...options]);
393
397
  return p.code();
@@ -528,9 +532,9 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
528
532
  if (nom === 'construire' && args.includes('--echec')) {
529
533
  return construireDepuisLesArguments(OUTIL, args, racine);
530
534
  }
531
- if (nom === 'typer' || nom === 'preparer' || nom === 'construire') {
535
+ if (nom === 'typer' || nom === 'construire') {
532
536
  // `construire` and `typer` with a path: the one project of that folder, as Turborepo's task of
533
- // one package; `typer` alone types them all, `preparer` syncs them all.
537
+ // one package; `typer` alone types them all.
534
538
  let choisis = composants(racine);
535
539
  if (nom === 'construire' || (nom === 'typer' && args.length)) {
536
540
  const [chemin, ...autres] = args;
@@ -169,7 +169,7 @@ export default {
169
169
  attendu: ['absent : sans fournisseur'],
170
170
  },
171
171
  commandes: {
172
- valide: ['tester', 'verifier', 'typer', 'preparer', 'tests-de-nuit', 'index-interfaces'],
172
+ valide: ['tester', 'verifier', 'typer', 'tests-de-nuit', 'index-interfaces'],
173
173
  invalide: ['tester', 'deployer'],
174
174
  attendu: ['deployer : absente'],
175
175
  },
@@ -21,7 +21,7 @@
21
21
  // readers, the entries of the index of the interfaces (./composants.mjs); the elements of a lot
22
22
  // (./lot.mjs).
23
23
  // - The commands `tester` (the projects' tasks of Turborepo), `tests-du-paquet` (the body of a
24
- // project's task), `verifier`, `typer`, `preparer` and `tests-de-nuit` (./commandes.mjs),
24
+ // project's task), `verifier`, `typer` and `tests-de-nuit` (./commandes.mjs),
25
25
  // each described, never run, and the verdict of a run (./verdict.mjs); the guard of the sizes of
26
26
  // the tests (./tailles-des-tests.mjs) and the index of the interfaces up to date, each a command
27
27
  // by its name too. The generated file, the index of the interfaces (./index-interfaces.mjs), its
@@ -33,7 +33,7 @@
33
33
  import { readFileSync } from 'node:fs';
34
34
  import path from 'node:path';
35
35
  import { fileURLToPath } from 'node:url';
36
- import { empreintesDesTaches } from '../../services-du-noyau.mjs';
36
+ import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
37
37
  import { commandes, GARDES, PYCACHE } from './commandes.mjs';
38
38
  import {
39
39
  composantDans,
@@ -69,6 +69,8 @@ export default {
69
69
  throw new Error('sortie non prise en charge pour python');
70
70
  },
71
71
  outils: ['smol-toml'],
72
+ // The programs the installer of Temporal requires in the PATH of the workers.
73
+ executables: ['python3'],
72
74
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
73
75
  ignorer: ['.venv', '.pytest_cache', PYCACHE],
74
76
  sorties: {
@@ -91,6 +93,13 @@ export default {
91
93
  elementsDuLot,
92
94
  // The hashes of the inputs of the tests tasks of the projects and their dependents, as
93
95
  // Turborepo plans them.
96
+ // The remote cache of Turborepo on the poste: its server, its team, its token and the key of its
97
+ // signature in ~/.config/grillhouse/turbo-cache.env, read alone, never written from the poste.
98
+ environnementDuPoste: env =>
99
+ avecLeFichierDuPoste(env, {
100
+ fichier: 'turbo-cache.env',
101
+ ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
102
+ }),
94
103
  empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
95
104
  commandes,
96
105
  verdict,
@@ -20,7 +20,7 @@
20
20
  import { existsSync, readFileSync } from 'node:fs';
21
21
  import path from 'node:path';
22
22
  import { pathToFileURL } from 'node:url';
23
- import { trancher } from '../../dette.mjs';
23
+ import { MODE, trancher } from '../../dette.mjs';
24
24
  import { composants, estDeNuit, fichiersDeTest } from './composants.mjs';
25
25
 
26
26
  // The name of its findings and of its debt, apart from the module typescript's guard of the same
@@ -84,19 +84,27 @@ export function verifier(racine) {
84
84
  }));
85
85
  }
86
86
 
87
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
88
- const racine = process.cwd();
87
+ // The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
88
+ // prefixed with `⛔`, then the debt's lines, then the count of each size), and `code`, its exit code
89
+ // (1 on a refusal). The functional core of the command: it reads the repository and the project's
90
+ // debt and writes nothing to the standard streams; the command below is its shell. The refusals
91
+ // reach SARIF through `trancher` under the results directory <env> names (scripts/resultats.mjs);
92
+ // without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
93
+ export function rapport(racine, env = process.env) {
89
94
  const toutes = tailles(racine);
90
95
  const compte = t => toutes.filter(x => x.taille === t).length;
91
- const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
92
- for (const r of refus) {
93
- process.stderr.write(`⛔ ${r.message}\n`);
94
- }
96
+ const { refus, lignes } = trancher(racine, GARDE, verifier(racine), env[MODE] || undefined, env);
97
+ const resume = `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit.`;
98
+ return {
99
+ lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes, resume],
100
+ code: refus.length ? 1 : 0,
101
+ };
102
+ }
103
+
104
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
105
+ const { lignes, code } = rapport(process.cwd());
95
106
  for (const l of lignes) {
96
107
  process.stderr.write(`${l}\n`);
97
108
  }
98
- process.stderr.write(
99
- `ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${toutes.filter(x => x.nuit).length} de nuit.\n`
100
- );
101
- process.exitCode = refus.length ? 1 : 0;
109
+ process.exitCode = code;
102
110
  }
@@ -43,7 +43,7 @@ import { tmpdir } from 'node:os';
43
43
  import path from 'node:path';
44
44
  import { pathToFileURL } from 'node:url';
45
45
  import { horsCadre } from '../../paquets.mjs';
46
- import { trancher } from '../../dette.mjs';
46
+ import { MODE, trancher } from '../../dette.mjs';
47
47
  import { isTestFile } from './regle-des-tests.mjs';
48
48
 
49
49
  const GENRES = {
@@ -280,9 +280,9 @@ function reglagesDependances(knipLu, racine, config, fichiers, paquets) {
280
280
  return { ...r, entry: entryRacine, workspaces: espaces };
281
281
  }
282
282
 
283
- // Runs knip on <config> (knip's defaults when null), restricted to <include> when given; the
284
- // spawn result.
285
- function knip(config, include) {
283
+ // Runs knip in <racine> on <config> (knip's defaults when null), restricted to <include> when
284
+ // given; the spawn result.
285
+ function knip(racine, config, include) {
286
286
  const args = ['--no-install', 'knip', '--reporter', 'json', '--no-progress'];
287
287
  if (include) {
288
288
  args.push('--include', include);
@@ -295,7 +295,7 @@ function knip(config, include) {
295
295
  writeFileSync(f, JSON.stringify(config));
296
296
  args.push('--config', f);
297
297
  }
298
- return spawnSync('npx', args, { encoding: 'utf8' });
298
+ return spawnSync('npx', args, { cwd: racine, encoding: 'utf8' });
299
299
  } finally {
300
300
  if (tmp) {
301
301
  rmSync(tmp, { recursive: true, force: true });
@@ -303,8 +303,14 @@ function knip(config, include) {
303
303
  }
304
304
  }
305
305
 
306
- // The command on the repository at <racine>: its exit code.
307
- async function codeMort(racine) {
306
+ // The report of the dead-code check at <racine>: `lignes`, what the command writes on stderr (each
307
+ // refusal and the debt's lines), and `code`, its exit code (1 on a refusal or a knip it cannot
308
+ // read). The functional core of the command: it runs knip and git and reads the project's debt, and
309
+ // writes nothing to the standard streams; the command below is its shell. The refusals reach SARIF
310
+ // through `trancher` under the results directory <env> names (scripts/resultats.mjs); without it none
311
+ // is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
312
+ export async function codeMort(racine, env = process.env) {
313
+ const lignes = [];
308
314
  const hors = reglages(racine);
309
315
  const fichierKnip = path.join(racine, 'knip.json');
310
316
  const config =
@@ -312,20 +318,21 @@ async function codeMort(racine) {
312
318
  const DEPS = ['dependencies', 'devDependencies'];
313
319
  const { fichiers, dossiers, erreur } = fichiersTests(racine);
314
320
  if (erreur) {
315
- process.stderr.write(`⛔ CODE MORT — git n'a pas listé les fichiers de test :\n${erreur}\n`);
316
- return 1;
321
+ lignes.push(`⛔ CODE MORT — git n'a pas listé les fichiers de test :\n${erreur}`);
322
+ return { lignes, code: 1 };
317
323
  }
318
324
  const knipLu = await knipDuDepot(racine);
319
325
  if (!knipLu) {
320
- process.stderr.write(
321
- '⛔ CODE MORT — knip du dépôt illisible : son matcher (picomatch), son ordre des clés (byPathDepth) ou son schéma des espaces manque.\n'
326
+ lignes.push(
327
+ '⛔ CODE MORT — knip du dépôt illisible : son matcher (picomatch), son ordre des clés (byPathDepth) ou son schéma des espaces manque.'
322
328
  );
323
- return 1;
329
+ return { lignes, code: 1 };
324
330
  }
325
- const premier = knip(hors ?? config);
331
+ const premier = knip(racine, hors ?? config);
326
332
  const c1 = constats(premier.stdout ?? '');
327
333
  const second = fichiers.length
328
334
  ? knip(
335
+ racine,
329
336
  reglagesDependances(
330
337
  knipLu,
331
338
  racine,
@@ -346,26 +353,36 @@ async function codeMort(racine) {
346
353
  }
347
354
  if (c === null) {
348
355
  const r = c1 ? second : premier;
349
- process.stderr.write(
350
- `⛔ CODE MORT — knip n'a rien mesuré :\n${(r.stderr || r.stdout || '').slice(0, 1000)}\n`
356
+ lignes.push(
357
+ `⛔ CODE MORT — knip n'a rien mesuré :\n${(r.stderr || r.stdout || '').slice(0, 1000)}`
351
358
  );
352
- return 1;
359
+ return { lignes, code: 1 };
353
360
  }
354
- const { refus, lignes } = trancher(racine, 'code-mort', c);
361
+ const { refus, lignes: lignesDette } = trancher(
362
+ racine,
363
+ 'code-mort',
364
+ c,
365
+ env[MODE] || undefined,
366
+ env
367
+ );
355
368
  if (refus.length) {
356
- process.stderr.write(
357
- `⛔ CODE MORT — ${refus.length} constat(s) : chacun se supprime, ou sort par son nom dans knip.json avec sa raison.\n`
369
+ lignes.push(
370
+ `⛔ CODE MORT — ${refus.length} constat(s) : chacun se supprime, ou sort par son nom dans knip.json avec sa raison.`
358
371
  );
359
372
  for (const x of refus) {
360
- process.stderr.write(` ${x.message}\n`);
373
+ lignes.push(` ${x.message}`);
361
374
  }
362
375
  }
363
- for (const l of lignes) {
364
- process.stderr.write(`${l}\n`);
376
+ for (const l of lignesDette) {
377
+ lignes.push(l);
365
378
  }
366
- return refus.length ? 1 : 0;
379
+ return { lignes, code: refus.length ? 1 : 0 };
367
380
  }
368
381
 
369
382
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
370
- process.exitCode = await codeMort(process.cwd());
383
+ const { lignes, code } = await codeMort(process.cwd());
384
+ for (const l of lignes) {
385
+ process.stderr.write(`${l}\n`);
386
+ }
387
+ process.exitCode = code;
371
388
  }
@@ -46,7 +46,7 @@
46
46
  import { existsSync, readFileSync } from 'node:fs';
47
47
  import path from 'node:path';
48
48
  import { pathToFileURL } from 'node:url';
49
- import { trancher } from '../../dette.mjs';
49
+ import { MODE, trancher } from '../../dette.mjs';
50
50
  import { horsCadre } from '../../paquets.mjs';
51
51
  import { composants, dossiers, matieres } from './composants.mjs';
52
52
  import { lireSiPresent, parcourir } from './parcours.mjs';
@@ -314,27 +314,38 @@ export function verifier(racine) {
314
314
  return { refus };
315
315
  }
316
316
 
317
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
318
- const racine = process.cwd();
319
- const verdict = verifier(racine);
320
- const { refus, lignes } = trancher(racine, 'consommateurs', verdict.refus);
321
- for (const r of refus) {
322
- process.stderr.write(`⛔ ${r.message}\n`);
323
- }
324
- for (const l of lignes) {
325
- process.stderr.write(`${l}\n`);
326
- }
317
+ // The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
318
+ // prefixed with `⛔`, the debt's lines, then the guidance that fits the kinds of refusal left), and
319
+ // `code`, its exit code (1 on a refusal). The functional core of the command: it reads the
320
+ // repository and the project's debt and writes nothing to the standard streams; the command below is
321
+ // its shell. The refusals reach SARIF through `trancher` under the results directory <env> names
322
+ // (scripts/resultats.mjs); without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
323
+ export function rapport(racine, env = process.env) {
324
+ const { refus, lignes } = trancher(
325
+ racine,
326
+ 'consommateurs',
327
+ verifier(racine).refus,
328
+ env[MODE] || undefined,
329
+ env
330
+ );
331
+ const sorties = [...refus.map(r => `⛔ ${r.message}`), ...lignes];
327
332
  if (refus.some(r => r.regle !== DECLARE_NON_UTILISE && r.regle !== LIGNE_MAL_FORMEE)) {
328
- process.stderr.write(
329
- "Une consommation nouvelle se décide (le titre du ticket, sa section « Architecture » ou sa section « Noms publiés » qui la nomment, sinon l'arbitrage du superviseur), puis entre dans la section « Consommateurs » de l'interface du fournisseur.\n"
333
+ sorties.push(
334
+ "Une consommation nouvelle se décide (le titre du ticket, sa section « Architecture » ou sa section « Noms publiés » qui la nomment, sinon l'arbitrage du superviseur), puis entre dans la section « Consommateurs » de l'interface du fournisseur."
330
335
  );
331
336
  }
332
337
  if (refus.some(r => r.regle === DECLARE_NON_UTILISE)) {
333
- process.stderr.write(
334
- "Un nom que son consommateur n'utilise plus sort de sa ligne dans la section « Consommateurs » de l'interface du fournisseur.\n"
338
+ sorties.push(
339
+ "Un nom que son consommateur n'utilise plus sort de sa ligne dans la section « Consommateurs » de l'interface du fournisseur."
335
340
  );
336
341
  }
337
- if (refus.length) {
338
- process.exitCode = 1;
342
+ return { lignes: sorties, code: refus.length ? 1 : 0 };
343
+ }
344
+
345
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
346
+ const { lignes, code } = rapport(process.cwd());
347
+ for (const l of lignes) {
348
+ process.stderr.write(`${l}\n`);
339
349
  }
350
+ process.exitCode = code;
340
351
  }
@@ -178,6 +178,7 @@ export default {
178
178
  'interfaces-contre-code',
179
179
  'resumes',
180
180
  'tailles-des-tests',
181
+ 'tests-du-poste',
181
182
  'titres-de-tests',
182
183
  'turbo-des-paquets',
183
184
  ],
@@ -261,6 +262,7 @@ export default {
261
262
  'interfaces-contre-code',
262
263
  'code-mort',
263
264
  'tailles-des-tests',
265
+ 'tests-du-poste',
264
266
  'titres-de-tests',
265
267
  'chemins-des-tests',
266
268
  'resumes',
@@ -59,6 +59,7 @@ export const RACINES = ['src', 'packages'];
59
59
  /** The test files, as a pattern of a path from the repository's root. */
60
60
  export const TESTS = '(^|/)(test|tests|__tests__)/|[.](test|spec)[.][a-z]+$';
61
61
  const REGLE_OUTILS = 'pas-d-outil-de-developpement-dans-le-code';
62
+ const REGLE_DECLARATION = 'pas-d-import-non-declare';
62
63
  // The environment variable naming the file that holds the pattern of the published files.
63
64
  const JUGES = 'GRILLHOUSE_JUGES';
64
65
 
@@ -160,6 +161,18 @@ export function configuration(racine) {
160
161
  from: { path: CODE, pathNot: TESTS },
161
162
  to: { dependencyTypes: ['npm-dev'] },
162
163
  },
164
+ {
165
+ name: REGLE_DECLARATION,
166
+ comment:
167
+ "un import vise un paquet que le package.json du paquet importateur déclare (la règle no-non-package-json de dependency-cruiser) : l'usage se déclare s'il est valide pour l'architecture, sinon une question d'architecture s'ouvre",
168
+ severity: 'error',
169
+ // The development imports (the test files and the tools' configuration files) are out of
170
+ // the published code: the tools they import (vitest, typescript) are the workspace's.
171
+ from: { pathNot: `${TESTS}|(^|/)[^/]*[.]config[.][cm]?[jt]s$` },
172
+ // A peer dependency is declared by the package, yet dependency-cruiser types it `npm-no-pkg`
173
+ // too: the types it carries as peer are not refused.
174
+ to: { dependencyTypes: ['npm-no-pkg', 'npm-unknown'], dependencyTypesNot: ['npm-peer'] },
175
+ },
163
176
  {
164
177
  name: 'tout-import-se-resout',
165
178
  comment: "un import se résout : un chemin qu'un paquet n'exporte pas est refusé",
@@ -425,6 +438,36 @@ export function constats(resultat) {
425
438
  }));
426
439
  }
427
440
 
441
+ // The package an import of a violation targets: the name in the `node_modules` path it resolves
442
+ // to (`@scope/name` or `name`), else the module's own name.
443
+ function paquetVise(violation) {
444
+ const m = /(?:^|\/)node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(violation.to);
445
+ return m ? m[1] : violation.to;
446
+ }
447
+
448
+ // The refusal of an import the package does not declare, with its two ways on: the file, the
449
+ // package imported, then declaring the usage (and, for a component of the repository, in the
450
+ // provider's "Consommateurs" section), else an architecture question.
451
+ export function suitesDeLUsage(racine, violation) {
452
+ const importe = paquetVise(violation);
453
+ const propre = /^(packages\/[^/]+)\//.exec(violation.from);
454
+ const manifeste = `${propre ? `${propre[1]}/` : ''}package.json`;
455
+ const fournisseur = composants(racine).find(c => c.paquet === importe);
456
+ const tete = `⛔ ${violation.from} importe ${importe}, que ${manifeste} ne déclare pas.`;
457
+ if (fournisseur) {
458
+ const interfaceDuFournisseur = `${posix(path.relative(racine, fournisseur.dir))}/docs/INTERFACE.md`;
459
+ return (
460
+ `${tete}\n Si l'usage est valide pour l'architecture : le déclarer dans ${manifeste}, et dans ` +
461
+ `la section « Consommateurs » de ${interfaceDuFournisseur}.\n Sinon : ouvrir une question ` +
462
+ "d'architecture (au superviseur)."
463
+ );
464
+ }
465
+ return (
466
+ `${tete}\n Si l'usage est valide pour l'architecture : le déclarer dans ${manifeste}.\n` +
467
+ " Sinon : ouvrir une question d'architecture (au superviseur)."
468
+ );
469
+ }
470
+
428
471
  // The pattern of the files to judge, as dependency-cruiser's `path` filter reads it.
429
472
  const motifDes = fichiers => `^(${[...fichiers].sort().map(echappe).join('|')})$`;
430
473
 
@@ -500,6 +543,9 @@ function frontieres(racine, args) {
500
543
  for (const l of lignes) {
501
544
  process.stderr.write(`${l}\n`);
502
545
  }
546
+ for (const c of refus.filter(c => c.regle === REGLE_DECLARATION)) {
547
+ process.stderr.write(`${suitesDeLUsage(racine, c.violation)}\n`);
548
+ }
503
549
  return refus.length ? 1 : 0;
504
550
  } finally {
505
551
  if (dossier) {
@@ -51,7 +51,11 @@ import { elementsDuLot } from './elements-du-lot.mjs';
51
51
  import { A_ELAGUER, lireSarif, RESULTATS } from '../../resultats.mjs';
52
52
  import { lecteurs } from './lecteurs.mjs';
53
53
  import { estUnTest, manifestes, soeurDAvant } from './regle-des-tests.mjs';
54
- import { empreintesDesTaches, SCRIPT_DES_TESTS } from '../../services-du-noyau.mjs';
54
+ import {
55
+ avecLeFichierDuPoste,
56
+ empreintesDesTaches,
57
+ SCRIPT_DES_TESTS,
58
+ } from '../../services-du-noyau.mjs';
55
59
  import { verdict } from './verdict.mjs';
56
60
  import { miseAJour } from './mise-a-jour.mjs';
57
61
  import { squelette } from './squelette.mjs';
@@ -65,6 +69,8 @@ import * as cheminsDesTests from './migrations/0.25.0-chemins-des-tests.mjs';
65
69
  import * as taillesDesOutilsLourds from './migrations/0.30.0-tailles-des-outils-lourds.mjs';
66
70
  import * as prefixeDesTickets from './migrations/0.30.0-prefixe-des-tickets.mjs';
67
71
  import * as titresNommantUnTicket from './migrations/0.30.0-titres-nommant-un-ticket.mjs';
72
+ import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
73
+ import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
68
74
 
69
75
  // The scripts of this module, beside this file.
70
76
  const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
@@ -85,6 +91,7 @@ const OUTILS = [
85
91
  'interfaces-contre-code',
86
92
  'resumes',
87
93
  'tailles-des-tests',
94
+ 'tests-du-poste',
88
95
  'titres-de-tests',
89
96
  'turbo-des-paquets',
90
97
  ];
@@ -195,8 +202,11 @@ export default {
195
202
  ],
196
203
  // No binary of the machine: its tools are packages of npm.
197
204
  binaires: {},
198
- // What its tools write in a project: Turborepo's runs and cache.
199
- ignorer: ['.turbo'],
205
+ // No program the installer of Temporal looks for: Node is a tool of the account.
206
+ executables: [],
207
+ // What its tools write in a project: Turborepo's runs and cache, and Vitest's reports of the
208
+ // tranches of a pass (./tranches.mjs).
209
+ ignorer: ['.turbo', '.vitest-reports'],
200
210
  // Where its tools write: the cache of Turborepo in the main tree, shared by every copy, written;
201
211
  // the logs of Turborepo's tasks (`.turbo/turbo-<task>.log`, written on every run, a task replayed
202
212
  // from its cache included, and which no option of Turborepo sends elsewhere) and the cache of
@@ -233,6 +243,13 @@ export default {
233
243
  elementsDuLot,
234
244
  // The hashes of the inputs of the tests tasks of the packages and their dependents, as
235
245
  // Turborepo plans them.
246
+ // The remote cache of Turborepo on the poste: its server, its team, its token and the key of its
247
+ // signature in ~/.config/grillhouse/turbo-cache.env, read alone, never written from the poste.
248
+ environnementDuPoste: env =>
249
+ avecLeFichierDuPoste(env, {
250
+ fichier: 'turbo-cache.env',
251
+ ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
252
+ }),
236
253
  empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
237
254
  commandes: racine => ({
238
255
  tester: { script: ici('tests.mjs'), args: [] },
@@ -240,6 +257,7 @@ export default {
240
257
  typer: { script: compilateur(racine), args: ['--noEmit'] },
241
258
  construire: { script: ici('construire.mjs'), args: [] },
242
259
  'tests-de-nuit': { script: ici('tests-de-nuit.mjs'), args: [] },
260
+ 'fusion-des-tranches': { script: ici('tranches.mjs'), args: [] },
243
261
  ...Object.fromEntries(OUTILS.map(n => [n, { script: ici(`${n}.mjs`), args: [] }])),
244
262
  }),
245
263
  verdict,
@@ -308,6 +326,7 @@ export default {
308
326
  [ici('interfaces-contre-code.mjs')],
309
327
  [ici('code-mort.mjs')],
310
328
  [ici('tailles-des-tests.mjs')],
329
+ [ici('tests-du-poste.mjs')],
311
330
  [ici('titres-de-tests.mjs')],
312
331
  [ici('chemins-des-tests.mjs')],
313
332
  [ici('resumes.mjs')],
@@ -322,6 +341,8 @@ export default {
322
341
  taillesDesOutilsLourds,
323
342
  prefixeDesTickets,
324
343
  titresNommantUnTicket,
344
+ binaireDeJour,
345
+ testsDuPoste,
325
346
  ],
326
347
  miseAJour: miseAJour(joueDesTests),
327
348
  squelette,