@roomi-fields/grillhouse 0.54.1 → 0.55.2

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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +73 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
  4. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
  5. package/cadre/templates/projet/CONTRIBUTING.md +0 -5
  6. package/cadre/templates/projet/README.md +0 -126
  7. package/cadre/templates/projet/_npmignore +1 -6
  8. package/cadre/templates/projet/package.json +5 -32
  9. package/cadre/templates/projet/tsconfig.json +4 -4
  10. package/cadre/templates/projet/vitest.config.cjs +3 -2
  11. package/charte/tests.md +14 -0
  12. package/dist/machine/part-par-sorte.d.ts +9 -9
  13. package/dist/machine/part-par-sorte.js +20 -24
  14. package/dist/machine/part-par-sorte.js.map +1 -1
  15. package/dist/machine/table-des-consommations.d.ts +65 -0
  16. package/dist/machine/table-des-consommations.js +94 -0
  17. package/dist/machine/table-des-consommations.js.map +1 -0
  18. package/dist/temporal/circuit/activites.d.ts +2 -0
  19. package/dist/temporal/circuit/activites.js +87 -3
  20. package/dist/temporal/circuit/activites.js.map +1 -1
  21. package/dist/temporal/circuit/client.js +9 -4
  22. package/dist/temporal/circuit/client.js.map +1 -1
  23. package/dist/temporal/circuit/contrat.d.ts +32 -4
  24. package/dist/temporal/circuit/deroule.js +54 -4
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/circuit/versions.d.ts +12 -0
  27. package/dist/temporal/circuit/versions.js +22 -0
  28. package/dist/temporal/circuit/versions.js.map +1 -0
  29. package/dist/temporal/consommation/activites.d.ts +2 -0
  30. package/dist/temporal/consommation/activites.js +9 -0
  31. package/dist/temporal/consommation/activites.js.map +1 -0
  32. package/dist/temporal/consommation/actualisation.d.ts +2 -0
  33. package/dist/temporal/consommation/actualisation.js +71 -0
  34. package/dist/temporal/consommation/actualisation.js.map +1 -0
  35. package/dist/temporal/consommation/client.d.ts +12 -0
  36. package/dist/temporal/consommation/client.js +28 -0
  37. package/dist/temporal/consommation/client.js.map +1 -0
  38. package/dist/temporal/consommation/commande.d.ts +5 -0
  39. package/dist/temporal/consommation/commande.js +32 -0
  40. package/dist/temporal/consommation/commande.js.map +1 -0
  41. package/dist/temporal/consommation/contrat.d.ts +15 -0
  42. package/dist/temporal/consommation/contrat.js +13 -0
  43. package/dist/temporal/consommation/contrat.js.map +1 -0
  44. package/dist/temporal/consommation/deroule.d.ts +2 -0
  45. package/dist/temporal/consommation/deroule.js +14 -0
  46. package/dist/temporal/consommation/deroule.js.map +1 -0
  47. package/dist/temporal/deroules.d.ts +2 -1
  48. package/dist/temporal/deroules.js +3 -2
  49. package/dist/temporal/deroules.js.map +1 -1
  50. package/dist/temporal/file/contrat.d.ts +2 -0
  51. package/dist/temporal/file/deroule.js +14 -4
  52. package/dist/temporal/file/deroule.js.map +1 -1
  53. package/dist/temporal/installation.d.ts +6 -0
  54. package/dist/temporal/installation.js +15 -0
  55. package/dist/temporal/installation.js.map +1 -1
  56. package/dist/temporal/nuits/activites.d.ts +2 -1
  57. package/dist/temporal/nuits/activites.js +127 -3
  58. package/dist/temporal/nuits/activites.js.map +1 -1
  59. package/dist/temporal/nuits/client.d.ts +19 -5
  60. package/dist/temporal/nuits/client.js +33 -23
  61. package/dist/temporal/nuits/client.js.map +1 -1
  62. package/dist/temporal/nuits/commande.js +16 -11
  63. package/dist/temporal/nuits/commande.js.map +1 -1
  64. package/dist/temporal/nuits/contrat.d.ts +29 -0
  65. package/dist/temporal/nuits/contrat.js +10 -0
  66. package/dist/temporal/nuits/contrat.js.map +1 -1
  67. package/dist/temporal/nuits/deroule.d.ts +5 -0
  68. package/dist/temporal/nuits/deroule.js +18 -1
  69. package/dist/temporal/nuits/deroule.js.map +1 -1
  70. package/dist/temporal/nuits/pc2.d.ts +72 -0
  71. package/dist/temporal/nuits/pc2.js +206 -0
  72. package/dist/temporal/nuits/pc2.js.map +1 -0
  73. package/dist/temporal/places/activites.d.ts +23 -1
  74. package/dist/temporal/places/activites.js +38 -2
  75. package/dist/temporal/places/activites.js.map +1 -1
  76. package/dist/temporal/places/client.d.ts +18 -2
  77. package/dist/temporal/places/client.js +28 -3
  78. package/dist/temporal/places/client.js.map +1 -1
  79. package/dist/temporal/places/contrat.d.ts +79 -14
  80. package/dist/temporal/places/contrat.js +7 -0
  81. package/dist/temporal/places/contrat.js.map +1 -1
  82. package/dist/temporal/places/deroule.js +159 -23
  83. package/dist/temporal/places/deroule.js.map +1 -1
  84. package/dist/temporal/places/reservation.d.ts +54 -0
  85. package/dist/temporal/places/reservation.js +69 -0
  86. package/dist/temporal/places/reservation.js.map +1 -0
  87. package/dist/temporal/planification.d.ts +6 -0
  88. package/dist/temporal/planification.js +26 -0
  89. package/dist/temporal/planification.js.map +1 -0
  90. package/dist/temporal/tickets/activites.d.ts +0 -2
  91. package/dist/temporal/tickets/activites.js +2 -52
  92. package/dist/temporal/tickets/activites.js.map +1 -1
  93. package/dist/temporal/tickets/contrat.d.ts +7 -26
  94. package/dist/temporal/tickets/deroule.js +35 -23
  95. package/dist/temporal/tickets/deroule.js.map +1 -1
  96. package/dist/temporal/travailleur.js +2 -0
  97. package/dist/temporal/travailleur.js.map +1 -1
  98. package/docs/ARCHITECTURE.md +2 -2
  99. package/docs/CADRE.md +1 -1
  100. package/docs/INTERFACE.md +16 -11
  101. package/docs/architecture/circuit.md +62 -58
  102. package/docs/architecture/entree.md +87 -63
  103. package/docs/architecture/greffon.md +24 -21
  104. package/docs/architecture/installation.md +35 -30
  105. package/docs/architecture/machine.md +48 -40
  106. package/docs/architecture/tests.md +37 -33
  107. package/docs/lexique.md +4 -3
  108. package/package.json +1 -1
  109. package/scripts/activites.mjs +351 -180
  110. package/scripts/aiguillage.mjs +1 -0
  111. package/scripts/attente-de-la-machine.mjs +3 -22
  112. package/scripts/avancement.mjs +21 -30
  113. package/scripts/bilan.mjs +22 -2
  114. package/scripts/branche-de-nuit.mjs +1 -1
  115. package/scripts/circuit.mjs +75 -39
  116. package/scripts/codes-de-sortie.mjs +0 -6
  117. package/scripts/coeurs-dedies.mjs +19 -2
  118. package/scripts/consommation-des-passes.mjs +67 -35
  119. package/scripts/consommation.mjs +152 -24
  120. package/scripts/copies-finies.mjs +15 -35
  121. package/scripts/dernier-vert.mjs +4 -5
  122. package/scripts/dette.mjs +5 -3
  123. package/scripts/droits.mjs +2 -2
  124. package/scripts/echantillonneur-de-la-passe.mjs +7 -31
  125. package/scripts/engendres.mjs +5 -61
  126. package/scripts/enveloppe/enveloppe.mjs +30 -34
  127. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
  128. package/scripts/etapes.mjs +21 -7
  129. package/scripts/etat-du-depot.mjs +61 -0
  130. package/scripts/faits-du-circuit.mjs +7 -4
  131. package/scripts/fermeture-de-la-machine.d.mts +6 -4
  132. package/scripts/fermeture-de-la-machine.mjs +12 -16
  133. package/scripts/fichier-du-poste.d.mts +9 -0
  134. package/scripts/file-des-tickets.d.mts +0 -18
  135. package/scripts/file-des-tickets.mjs +0 -42
  136. package/scripts/fusion-du-changelog.mjs +1 -1
  137. package/scripts/grillhouse-maj.mjs +1 -1
  138. package/scripts/index-des-rouges.d.mts +40 -0
  139. package/scripts/index-des-rouges.mjs +104 -0
  140. package/scripts/integration/file.mjs +13 -63
  141. package/scripts/integration/integrer.mjs +157 -424
  142. package/scripts/integration/jugement.mjs +109 -0
  143. package/scripts/integration/rejeu.mjs +94 -71
  144. package/scripts/jointure.d.ts +34 -27
  145. package/scripts/journal-des-etats.d.mts +1 -1
  146. package/scripts/langages/c/commandes.mjs +27 -12
  147. package/scripts/langages/cargo/commandes.mjs +148 -94
  148. package/scripts/langages/cargo/index.mjs +2 -1
  149. package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
  150. package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
  151. package/scripts/langages/python/commandes.mjs +31 -15
  152. package/scripts/langages/python/index.mjs +2 -1
  153. package/scripts/langages/python/lectures-des-tests.mjs +148 -0
  154. package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
  155. package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
  156. package/scripts/langages/typescript/index.mjs +4 -0
  157. package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
  158. package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
  159. package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
  160. package/scripts/langages/typescript/tests.mjs +11 -37
  161. package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
  162. package/scripts/langages/typescript/verifier.mjs +74 -44
  163. package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
  164. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
  165. package/scripts/lectures-communes.mjs +234 -0
  166. package/scripts/machine.mjs +11 -18
  167. package/scripts/mesure/base-de-passe.mjs +1 -2
  168. package/scripts/mesure-de-la-machine.d.mts +43 -3
  169. package/scripts/mesure-de-la-machine.mjs +209 -11
  170. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
  171. package/scripts/migrations/nuit-yml-retire.mjs +25 -0
  172. package/scripts/migrations/part-retiree.mjs +31 -0
  173. package/scripts/migrations/table-des-consommations.mjs +36 -0
  174. package/scripts/migrations.mjs +6 -0
  175. package/scripts/montee.mjs +9 -0
  176. package/scripts/nuit-de-pc2.mjs +628 -0
  177. package/scripts/nuit.sh +8 -131
  178. package/scripts/paquets.mjs +1 -1
  179. package/scripts/passe-de-la-machine.mjs +365 -105
  180. package/scripts/place-du-circuit.d.mts +15 -0
  181. package/scripts/place-du-circuit.mjs +32 -0
  182. package/scripts/places-de-la-machine.mjs +148 -627
  183. package/scripts/places-du-serveur.mjs +43 -16
  184. package/scripts/plafond-de-la-machine.d.mts +8 -13
  185. package/scripts/plafond-de-la-machine.mjs +37 -69
  186. package/scripts/registre-des-entrees.mjs +57 -0
  187. package/scripts/regles-des-places.d.mts +84 -50
  188. package/scripts/regles-des-places.mjs +200 -156
  189. package/scripts/retirer-copie.sh +2 -2
  190. package/scripts/seances.mjs +181 -63
  191. package/scripts/secours.mjs +95 -0
  192. package/scripts/services-du-noyau.mjs +11 -19
  193. package/scripts/sous-commandes.mjs +1 -0
  194. package/scripts/sous-modules.sh +1 -1
  195. package/scripts/superviseur.mjs +16 -7
  196. package/scripts/table-des-consommations.d.mts +9 -0
  197. package/scripts/table-des-consommations.mjs +35 -0
  198. package/scripts/tableau.mjs +33 -19
  199. package/scripts/taches-du-graphe.mjs +124 -2
  200. package/scripts/transitions.d.mts +27 -5
  201. package/scripts/transitions.mjs +125 -104
  202. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  203. package/scripts/verdict-de-la-nuit.mjs +34 -7
  204. package/scripts/verrou-de-fichier.mjs +1 -2
  205. package/scripts/workflows-du-cadre.mjs +2 -2
  206. package/skills/developpeur/SKILL.md +8 -2
  207. package/skills/direct/SKILL.md +5 -0
  208. package/skills/explorateur/SKILL.md +10 -1
  209. package/skills/grill/SKILL.md +2 -4
  210. package/skills/pitmaster/SKILL.md +7 -5
  211. package/skills/pitmaster/references/consigne-agent.md +1 -1
  212. package/skills/relecteur/SKILL.md +4 -1
  213. package/skills/testwriter/SKILL.md +15 -2
  214. package/cadre/templates/projet/.env.example +0 -57
  215. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  216. package/cadre/templates/projet/deployment/README.md +0 -98
  217. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  218. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  219. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  220. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  221. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  222. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  223. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  224. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  225. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  226. package/cadre/templates/projet/src/config.ts +0 -68
  227. package/cadre/templates/projet/src/errors.ts +0 -102
  228. package/cadre/templates/projet/src/index.ts +0 -46
  229. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  230. package/cadre/templates/projet/src/types/index.ts +0 -24
  231. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  232. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  233. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  234. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  235. package/cadre/templates/projet/tsconfig.build.json +0 -14
  236. package/scripts/flux-de-la-nuit.mjs +0 -39
  237. package/scripts/garde-de-la-memoire.mjs +0 -231
  238. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -5,7 +5,7 @@
5
5
  //
6
6
  // npx grillhouse tests [--force] [<chemin>…] [--<option>…] tester
7
7
  // npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
8
- // npx grillhouse verifier [--tout | --gardes] verifier
8
+ // npx grillhouse verifier [--tout | --force | --gardes] verifier
9
9
  // node commandes.mjs typer typer
10
10
  // npx grillhouse tests-de-nuit tests-de-nuit
11
11
  // npx grillhouse tailles-des-tests | index-interfaces each guard, its own script
@@ -41,13 +41,13 @@
41
41
  // (`*_nuit_test.py`, the one class out of the day: Python has no time budget bench) are left out
42
42
  // of every folder, played whole or named (`--ignore-glob`), and a night test named is refused,
43
43
  // named, and nothing plays (code 2), as the module cargo's: the night alone plays it. `--force` changes nothing here:
44
- // pytest keeps no result to replay. Another option goes to pytest. A project played whole (its
44
+ // pytest keeps no result to replay (in `verifier`, `--force` plays the complete pass, as `--tout`). Another option goes to pytest. A project played whole (its
45
45
  // own folder named) whose pytest collects no test (code 5) is green, as `cargo test` on a crate
46
46
  // without a test and the skeleton typescript's `passWithNoTests`; a path within the project that
47
47
  // collects no test stays red, as a run whose paths name no test fails in every language.
48
48
  // - `verifier` plays the typing and the tests of the projects as the tasks of Turborepo (`turbo run
49
49
  // typecheck test:unit --filter=<projet>…`, the cache of the tasks selecting those that play
50
- // again; `--tout` plays the tests for real, the moment of the pass in the variable
50
+ // again; `--tout` or `--force` (the night) plays the tests for real, the moment of the pass in the variable
51
51
  // `GRILLHOUSE_TESTS`). It keeps no green: the one pass of the verification keeps it
52
52
  // (scripts/dernier-vert.mjs, scripts/langages/typescript/verifier.mjs). Beside the module of
53
53
  // package.json, whose pass plays every task of the graph, the composed command sets
@@ -102,6 +102,7 @@ import {
102
102
  gesteDuPackageJson,
103
103
  GRAPHE_JOUE,
104
104
  joueCeQuiNeSeDivisePas,
105
+ lancerEntiersEtFichiers,
105
106
  lancerLesTaches,
106
107
  ligneDesRestes,
107
108
  nomDuPaquet,
@@ -109,6 +110,7 @@ import {
109
110
  retirerALInterruption,
110
111
  SCRIPT_DES_TESTS,
111
112
  SCRIPTS_DE_GARDES,
113
+ passeComplete,
112
114
  testsCibles,
113
115
  travailleursDeLaSeance,
114
116
  } from '../../services-du-noyau.mjs';
@@ -146,6 +148,7 @@ export const CACHE_DE_PYTEST = '.pytest_cache';
146
148
  /** The guards of the module: each its name and its script beside this one. */
147
149
  export const GARDES = [
148
150
  { nom: 'tailles-des-tests', args: [] },
151
+ { nom: 'lectures-des-tests', args: [] },
149
152
  { nom: 'index-interfaces', args: ['--verifier'] },
150
153
  ].map(g => ({
151
154
  ...g,
@@ -408,16 +411,29 @@ function tester(racine, args, env) {
408
411
  if (noms.size === 0) {
409
412
  return 0;
410
413
  }
411
- return lancerLesTaches({
412
- outil: OUTIL,
413
- racine,
414
- taches: [SCRIPT_DES_TESTS],
415
- noms,
416
- tests: testsCibles({
417
- arguments: [...chemins.map(c => path.resolve(racine, c)), ...options],
418
- force: args.includes('--force'),
419
- }),
420
- env,
414
+ return lancerEntiersEtFichiers({
415
+ chemins: chemins.map(c => path.resolve(racine, c)),
416
+ dossiers: tous.map(c => c.dossier),
417
+ options,
418
+ force: passeComplete(args),
419
+ lancer: ({ chemins: lot, tests }) => {
420
+ const duLot = lot.length
421
+ ? nomsDuGraphe(
422
+ racine,
423
+ choisir(racine, tous, lot).choix.map(x => x.c)
424
+ ).noms
425
+ : noms;
426
+ return duLot.size
427
+ ? lancerLesTaches({
428
+ outil: OUTIL,
429
+ racine,
430
+ taches: [SCRIPT_DES_TESTS],
431
+ noms: duLot,
432
+ tests,
433
+ env,
434
+ })
435
+ : 0;
436
+ },
421
437
  });
422
438
  }
423
439
 
@@ -453,7 +469,7 @@ function testsDuPaquet(racine, args, env) {
453
469
  }
454
470
 
455
471
  // The pass of `verifier` in <racine>, under the lock of the machine: the typing and the tests of
456
- // the projects as tasks of Turborepo (the tests played for real with <args> `--tout`). It keeps no
472
+ // the projects as tasks of Turborepo (the tests played for real with <args> `--tout` or `--force`). It keeps no
457
473
  // green.
458
474
  function verifier(racine, args, env) {
459
475
  if (args.includes('--gardes')) {
@@ -473,7 +489,7 @@ function verifier(racine, args, env) {
473
489
  racine,
474
490
  taches: [TYPAGE, SCRIPT_DES_TESTS],
475
491
  noms,
476
- tests: testsCibles({ arguments: [], force: args.includes('--tout') }),
492
+ tests: testsCibles({ arguments: [], force: passeComplete(args) }),
477
493
  env,
478
494
  });
479
495
  if (code !== 0) {
@@ -52,6 +52,7 @@ import {
52
52
  import { enRetard, SORTIE } from './index-interfaces.mjs';
53
53
  import { elementsDuLot } from './lot.mjs';
54
54
  import { miseAJour } from './mise-a-jour.mjs';
55
+ import * as lecturesDesTests from './migrations/lectures-des-tests.mjs';
55
56
  import { squelette } from './squelette.mjs';
56
57
  import { verdict } from './verdict.mjs';
57
58
 
@@ -132,7 +133,7 @@ export default {
132
133
  ],
133
134
  entreesDeLIndex,
134
135
  gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
135
- migrations: [],
136
+ migrations: [lecturesDesTests],
136
137
  miseAJour,
137
138
  squelette,
138
139
  };
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env node
2
+ // The readings of a document or of a source by the tests, on the model of « Change-Detector Tests
3
+ // Considered Harmful » (Google): a test proves a behaviour by its interface; one that reads the
4
+ // text of a document or of a file of code detects a change of wording, not a failure. The guard
5
+ // `lectures-des-tests` (packages/grillhouse/docs/architecture/tests.md §3.4).
6
+ //
7
+ // npx grillhouse lectures-des-tests run from the repository root (a guard of grillhouse:gardes)
8
+ //
9
+ // - The test files are those of ./tailles-des-tests.mjs (`tailles`). A finding,
10
+ // `{ fichier, regle: 'lecture-de-document-ou-de-code', message }`, is a test with a call
11
+ // `open(...)`, `<chemin>.read_text()` or `<chemin>.read_bytes()` whose path is a string, a constant
12
+ // of the file, a `Path(...)` or `os.path.join(...)` of strings, or a `/` of such paths, and names
13
+ // an existing `.md` or code file (`.ts`, `.mjs`, `.js`, `.rs`, `.py`, `.sh`) of the repository,
14
+ // resolved from the root or from the directory of the test. A manifest, a datum, a template, a
15
+ // flow of CI, a generated reference and a file the test creates in a temporary folder are no
16
+ // finding; a path built at run time that the guard does not resolve is none either.
17
+ // - A reading allowed carries `# @lit-source: <raison>` in the head comment of the test (the shared
18
+ // judgment: ../../services-du-noyau.mjs, lectures-communes.mjs); a label without a reason is refused.
19
+ // - A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes: those
20
+ // that exist when the guard arrives are inscribed by the update
21
+ // (./migrations/lectures-des-tests.mjs), the count never rises, and a new one is refused.
22
+ import { pathToFileURL } from 'node:url';
23
+ import { trancher } from '../../dette.mjs';
24
+ import { analyse, constatsDesLectures } from '../../services-du-noyau.mjs';
25
+ import { tailles } from './tailles-des-tests.mjs';
26
+
27
+ const { argumentsDuAppel, joindre, litteral, sansCommentaires } = analyse;
28
+
29
+ export const GARDE = 'lectures-des-tests-python';
30
+
31
+ const OUVRIR = /(?<![\w.])open\s*\(/g;
32
+ const LIRE = /\.(?:read_text|read_bytes)\s*\(/g;
33
+ const IDENTIFIANT = /^[A-Za-z_]\w*$/;
34
+ const CHEMIN = /^(?:pathlib\.)?(?:Path|PurePath)\s*\(/;
35
+ const JOINT = /^os\.path\.join\s*\(/;
36
+
37
+ // The top-level split of <e> at the operator `/`.
38
+ function parSlash(e) {
39
+ const parts = [];
40
+ let profondeur = 0;
41
+ let debut = 0;
42
+ for (let i = 0; i < e.length; i++) {
43
+ const ch = e[i];
44
+ if (ch === '"' || ch === "'") {
45
+ i = e.indexOf(ch, i + 1);
46
+ if (i < 0) {
47
+ return [e];
48
+ }
49
+ } else if (ch === '(' || ch === '[') {
50
+ profondeur++;
51
+ } else if (ch === ')' || ch === ']') {
52
+ profondeur--;
53
+ } else if (ch === '/' && profondeur === 0) {
54
+ parts.push(e.slice(debut, i));
55
+ debut = i + 1;
56
+ }
57
+ }
58
+ parts.push(e.slice(debut));
59
+ return parts;
60
+ }
61
+
62
+ // The path an expression of <texte> names, null when the guard does not resolve it.
63
+ function chemin(expr, texte, profondeur = 0) {
64
+ if (profondeur > 6) {
65
+ return null;
66
+ }
67
+ const e = expr
68
+ .trim()
69
+ .replace(/^str\s*\((.*)\)$/s, '$1')
70
+ .trim();
71
+ const l = litteral(e.replace(/^[rbf]+(?=['"])/i, ''));
72
+ if (l !== null) {
73
+ return l;
74
+ }
75
+ if (IDENTIFIANT.test(e)) {
76
+ const m = new RegExp(`^[ \\t]*${e}[ \\t]*(?::[^=\\n]+)?=[ \\t]*([^\\n=][^\\n]*)$`, 'm').exec(
77
+ texte
78
+ );
79
+ return m ? chemin(m[1], texte, profondeur + 1) : null;
80
+ }
81
+ const slash = parSlash(e);
82
+ if (slash.length > 1) {
83
+ return joindre(slash.map(s => chemin(s, texte, profondeur + 1)));
84
+ }
85
+ const p = CHEMIN.exec(e) ?? JOINT.exec(e);
86
+ if (p && e.endsWith(')')) {
87
+ const args = argumentsDuAppel(e, p[0].length - 1);
88
+ return args.length ? joindre(args.map(a => chemin(a, texte, profondeur + 1))) : null;
89
+ }
90
+ return null;
91
+ }
92
+
93
+ // The receiver of the method whose `.` is at <point> in <texte>: back to the start of its expression.
94
+ function receveur(texte, point) {
95
+ let profondeur = 0;
96
+ let i = point - 1;
97
+ for (; i >= 0; i--) {
98
+ const ch = texte[i];
99
+ if (ch === ')' || ch === ']') {
100
+ profondeur++;
101
+ } else if (ch === '(' || ch === '[') {
102
+ if (profondeur === 0) {
103
+ break;
104
+ }
105
+ profondeur--;
106
+ } else if (profondeur === 0 && (ch === '=' || ch === ',' || ch === '\n' || ch === ':')) {
107
+ break;
108
+ }
109
+ }
110
+ return texte.slice(i + 1, point);
111
+ }
112
+
113
+ /** The files <lire> accepts among those the test <texte> reads. */
114
+ function lectures(texte, _test, lire) {
115
+ const c = sansCommentaires(texte, { diese: true });
116
+ const ouverts = [...c.matchAll(OUVRIR)].map(
117
+ m => argumentsDuAppel(c, m.index + m[0].length - 1)[0]
118
+ );
119
+ const lus = [...c.matchAll(LIRE)].map(m => receveur(c, m.index));
120
+ return [...ouverts, ...lus].map(e => {
121
+ const v = e === undefined ? null : chemin(e, c);
122
+ return v === null ? null : lire(v);
123
+ });
124
+ }
125
+
126
+ /**
127
+ * The findings of the project at <racine>: one `{ fichier, regle, message }` per test that reads a
128
+ * document or a file of code of the repository, in the debt's form (../../dette.mjs).
129
+ */
130
+ export function verifier(racine) {
131
+ return constatsDesLectures(
132
+ racine,
133
+ tailles(racine).map(t => t.fichier),
134
+ lectures
135
+ );
136
+ }
137
+
138
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
139
+ const racine = process.cwd();
140
+ const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
141
+ for (const r of refus) {
142
+ process.stderr.write(`⛔ ${r.message}\n`);
143
+ }
144
+ for (const l of lignes) {
145
+ process.stderr.write(`${l}\n`);
146
+ }
147
+ process.exitCode = refus.length ? 1 : 0;
148
+ }
@@ -0,0 +1,31 @@
1
+ // The migration of the guard of the readings of the tests
2
+ // (scripts/langages/python/lectures-des-tests.mjs): it inscribes the tests that read the content of a
3
+ // document or of a file of code of the repository as the project's known debt (scripts/dette.mjs),
4
+ // frozen: the count never rises and a new one is refused. Migrations:
5
+ // packages/grillhouse/docs/architecture/installation.md §5.4; the guard: tests.md §3.4.
6
+ //
7
+ // - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds
8
+ // one and the file holds no section of it yet; the rest of the debt stays.
9
+ // - It rewrites no test of the project.
10
+ // - Replayable without effect: once the section is written, nothing.
11
+ import { FICHIER, lire, trancher } from '../../../dette.mjs';
12
+ import { GARDE, verifier } from '../lectures-des-tests.mjs';
13
+
14
+ // Not released yet: the release command numbers it.
15
+ export const version = '0.55.0';
16
+ export const nom = 'lectures des tests';
17
+
18
+ /** Inscribes the readings of a document or of a source by the tests of the project at <projet>; what it did. */
19
+ export function migrer(projet) {
20
+ if (lire(projet)[GARDE]) {
21
+ return [];
22
+ }
23
+ const constats = verifier(projet);
24
+ if (constats.length === 0) {
25
+ return [];
26
+ }
27
+ trancher(projet, GARDE, constats, 'inscrire', {});
28
+ return [
29
+ `${FICHIER} : ${constats.length} test(s) qui lisent le contenu d'un document ou d'un fichier de code, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et un test importe l'interface au lieu de lire un texte`,
30
+ ];
31
+ }
@@ -47,7 +47,7 @@ import path from 'node:path';
47
47
  import { pathToFileURL } from 'node:url';
48
48
  import { lireLigne, matieres } from './consommateurs.mjs';
49
49
  import { trancher } from '../../dette.mjs';
50
- import { arbitrageTranche, estArbitrage } from '../../services-du-noyau.mjs';
50
+ import { arbitrageTranche, baseDuLot, estArbitrage } from '../../services-du-noyau.mjs';
51
51
  import { aVerifier, marques, mesureDe } from './interfaces-contre-code.mjs';
52
52
 
53
53
  const REGLE = 'consommateur-sans-arbitrage';
@@ -145,7 +145,7 @@ export function verifier(racine, env = process.env) {
145
145
  continue;
146
146
  }
147
147
  const rel = path.relative(racine, iface);
148
- const head = git(racine, 'show', `HEAD:${rel}`);
148
+ const head = git(racine, 'show', `${baseDuLot(racine) ?? 'HEAD'}:${rel}`);
149
149
  interfaces.push({
150
150
  rel,
151
151
  avant: head.status === 0 ? head.stdout : null,
@@ -78,6 +78,7 @@ import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
78
78
  import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
79
79
  import * as cacheDesOutils from './migrations/0.34.1-cache-des-outils.mjs';
80
80
  import * as testsEquipes from './migrations/0.49.0-tests-equipes.mjs';
81
+ import * as lecturesDeDocuments from './migrations/lectures-des-tests.mjs';
81
82
  import * as configurationsEnCommonJs from './migrations/configurations-en-commonjs.mjs';
82
83
  import { COMMANDE as COMMANDE_DU_VERROU } from './verrou-des-dependances.mjs';
83
84
 
@@ -98,6 +99,7 @@ const OUTILS = [
98
99
  'frontieres',
99
100
  'index-interfaces',
100
101
  'interfaces-contre-code',
102
+ 'lectures-des-tests',
101
103
  'resumes',
102
104
  'tailles-des-tests',
103
105
  'tests-du-poste',
@@ -361,6 +363,7 @@ export default {
361
363
  [ici('tests-du-poste.mjs')],
362
364
  [ici('titres-de-tests.mjs')],
363
365
  [ici('chemins-des-tests.mjs')],
366
+ [ici('lectures-des-tests.mjs')],
364
367
  [ici('resumes.mjs')],
365
368
  [ici('verrou-des-dependances.mjs')],
366
369
  ],
@@ -378,6 +381,7 @@ export default {
378
381
  testsDuPoste,
379
382
  cacheDesOutils,
380
383
  testsEquipes,
384
+ lecturesDeDocuments,
381
385
  configurationsEnCommonJs,
382
386
  ],
383
387
  miseAJour: miseAJour(joueDesTests),
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ // The readings of a document or of a source by the tests, on the model of « Change-Detector Tests
3
+ // Considered Harmful » (Google): a test proves a behaviour by its interface; one that reads the
4
+ // text of a document or of a file of code detects a change of wording, not a failure. The guard
5
+ // `lectures-des-tests` (packages/grillhouse/docs/architecture/tests.md §3.4).
6
+ //
7
+ // npx grillhouse lectures-des-tests run from the repository root (a guard of grillhouse:gardes)
8
+ //
9
+ // - The test files are those of ./tailles-des-tests.mjs (`testsDuDepot`). A finding,
10
+ // `{ fichier, regle: 'lecture-de-document-ou-de-code', message }`, is a test with a call
11
+ // `readFileSync`, `readFile` or `fs.promises.readFile` whose path is a string, a constant of the
12
+ // file, or a `path.join` / `path.resolve` of strings (`__dirname`, `process.cwd()`, constants), and
13
+ // names an existing `.md` or code file (`.ts`, `.mjs`, `.js`, `.rs`, `.py`, `.sh`) of the
14
+ // repository. An import, the launch of a script, a manifest, a datum, a template, a flow of CI, a
15
+ // generated reference and a file the test creates in a temporary folder are no finding; a path
16
+ // built at run time that the guard does not resolve is none either.
17
+ // - A reading allowed carries `@lit-source: <raison>` in the head comment of the test (the shared
18
+ // judgment: ../../services-du-noyau.mjs, lectures-communes.mjs); a label without a reason is refused.
19
+ // - A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes: those
20
+ // that exist when the guard arrives are inscribed by the update
21
+ // (./migrations/lectures-des-tests.mjs), the count never rises, and a new one is refused.
22
+ import { pathToFileURL } from 'node:url';
23
+ import { trancher } from '../../dette.mjs';
24
+ import { analyse, constatsDesLectures } from '../../services-du-noyau.mjs';
25
+ import { testsDuDepot } from './tailles-des-tests.mjs';
26
+ import { code } from './vitest-config/lances.mjs';
27
+
28
+ const { argumentsDuAppel, expressionDepuis, joindre, litteral } = analyse;
29
+
30
+ export const GARDE = 'lectures-des-tests';
31
+
32
+ // A call that reads the content of a file.
33
+ const LECTURE = /(?<![\w$])(?:fs\.promises\.|promises\.|fs\.)?(?:readFileSync|readFile)\s*\(/g;
34
+ const IDENTIFIANT = /^[A-Za-z_$][\w$]*$/;
35
+ const DOSSIER_DU_TEST = /^(?:__dirname|import\.meta\.dirname)$/;
36
+ const RACINE = /^process\.cwd\(\)$/;
37
+ const JOINT = /^(?:path\.)?(?:join|resolve)\s*\(/;
38
+
39
+ // The path an expression of <texte> names, from the directory of the test or the root ('.'), null
40
+ // when the guard does not resolve it.
41
+ function chemin(expr, texte, profondeur = 0) {
42
+ if (profondeur > 6) {
43
+ return null;
44
+ }
45
+ const e = expr.trim();
46
+ const l = litteral(e);
47
+ if (l !== null) {
48
+ return l;
49
+ }
50
+ if (DOSSIER_DU_TEST.test(e) || RACINE.test(e)) {
51
+ return '.';
52
+ }
53
+ if (IDENTIFIANT.test(e)) {
54
+ const m = new RegExp(
55
+ `(?:const|let|var)\\s+${e.replace(/\$/g, '\\$')}\\s*(?::[^=\\n]+)?=\\s*`
56
+ ).exec(texte);
57
+ return m ? chemin(expressionDepuis(texte, m.index + m[0].length), texte, profondeur + 1) : null;
58
+ }
59
+ const j = JOINT.exec(e);
60
+ if (j && e.endsWith(')')) {
61
+ const args = argumentsDuAppel(e, j[0].length - 1);
62
+ return args.length ? joindre(args.map(a => chemin(a, texte, profondeur + 1))) : null;
63
+ }
64
+ return null;
65
+ }
66
+
67
+ /** The files <lire> accepts among those the test <texte> reads: each path it resolves, from the root. */
68
+ function lectures(texte, _test, lire) {
69
+ const c = code(texte);
70
+ return [...c.matchAll(LECTURE)].map(m => {
71
+ const [premier] = argumentsDuAppel(c, m.index + m[0].length - 1);
72
+ const v = premier === undefined ? null : chemin(premier, c);
73
+ return v === null ? null : lire(v);
74
+ });
75
+ }
76
+
77
+ /**
78
+ * The findings of the repository at <racine>: one `{ fichier, regle, message }` per test that
79
+ * reads a document or a file of code of the repository, in the debt's form (../../dette.mjs).
80
+ */
81
+ export function verifier(racine) {
82
+ return constatsDesLectures(racine, testsDuDepot(racine), lectures);
83
+ }
84
+
85
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
86
+ const racine = process.cwd();
87
+ const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
88
+ for (const r of refus) {
89
+ process.stderr.write(`⛔ ${r.message}\n`);
90
+ }
91
+ for (const l of lignes) {
92
+ process.stderr.write(`${l}\n`);
93
+ }
94
+ process.exitCode = refus.length ? 1 : 0;
95
+ }
@@ -0,0 +1,31 @@
1
+ // The migration of the guard of the readings of the tests
2
+ // (scripts/langages/typescript/lectures-des-tests.mjs): it inscribes the tests that read the content of a
3
+ // document or of a file of code of the repository as the project's known debt (scripts/dette.mjs),
4
+ // frozen: the count never rises and a new one is refused. Migrations:
5
+ // packages/grillhouse/docs/architecture/installation.md §5.4; the guard: tests.md §3.4.
6
+ //
7
+ // - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds
8
+ // one and the file holds no section of it yet; the rest of the debt stays.
9
+ // - It rewrites no test of the project.
10
+ // - Replayable without effect: once the section is written, nothing.
11
+ import { FICHIER, lire, trancher } from '../../../dette.mjs';
12
+ import { GARDE, verifier } from '../lectures-des-tests.mjs';
13
+
14
+ // Not released yet: the release command numbers it.
15
+ export const version = '0.55.0';
16
+ export const nom = 'lectures des tests';
17
+
18
+ /** Inscribes the readings of a document or of a source by the tests of the project at <projet>; what it did. */
19
+ export function migrer(projet) {
20
+ if (lire(projet)[GARDE]) {
21
+ return [];
22
+ }
23
+ const constats = verifier(projet);
24
+ if (constats.length === 0) {
25
+ return [];
26
+ }
27
+ trancher(projet, GARDE, constats, 'inscrire', {});
28
+ return [
29
+ `${FICHIER} : ${constats.length} test(s) qui lisent le contenu d'un document ou d'un fichier de code, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et un test importe l'interface au lieu de lire un texte`,
30
+ ];
31
+ }
@@ -7,8 +7,7 @@
7
7
  // node tests-de-nuit.mjs from the root of the copy: the night of the poste
8
8
  // node tests-de-nuit.mjs --hors-du-poste the night of an equipped runner: all but @poste
9
9
  // node tests-de-nuit.mjs --hors-du-poste --sans-equipement all but @poste and @equipee
10
- // node tests-de-nuit.mjs --du-poste the tests tagged @poste, then the measures of time unless
11
- // the project's Nuit flow plays them
10
+ // node tests-de-nuit.mjs --du-poste the tests tagged @poste, then the measures of time
12
11
  // node tests-de-nuit.mjs --mesures the benches and the time witnesses alone
13
12
  // node tests-de-nuit.mjs --hors-du-poste --tranche i/n its tranche i of n
14
13
  //
@@ -45,10 +44,10 @@
45
44
  // - The exit code: 0 when every run is green; 75, « à repasser », when every red run is at 75
46
45
  // (every failure depended on a duration, one under load, ./vitest-config/duree.reporter.mjs);
47
46
  // else the code of the first red run.
48
- // - The night tests play on the part of their project (`avecLaPasse` of
49
- // scripts/passe-de-la-machine.mjs, the sort « Nuit »), the measures of time on dedicated cores
50
- // (`mesure`, `grillhouse.mesure`), once the temporary directory and the disk of the copy have
51
- // room, as every pass: a wait that reaches its bound ends at 75.
47
+ // - The night tests play on the reservation of the arbiter (`avecLaPasse` of
48
+ // scripts/passe-de-la-machine.mjs, the sort « Nuit », the measures of time « Mesures de nuit »),
49
+ // once the temporary directory and the disk of the copy have room, as every pass: a wait that
50
+ // reaches its bound ends at 75, an arbiter that does not answer ends at 1, named.
52
51
  import { spawnSync } from 'node:child_process';
53
52
  import { existsSync, readdirSync, rmSync } from 'node:fs';
54
53
  import path from 'node:path';
@@ -56,7 +55,6 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
56
55
  import {
57
56
  A_REPASSER,
58
57
  avecLaPasse,
59
- fluxDuProjetJoueLesMesures,
60
58
  LA_FORME,
61
59
  lireLaTranche,
62
60
  } from '../../services-du-noyau.mjs';
@@ -151,10 +149,8 @@ export function runsDeLaNuit(
151
149
  : [];
152
150
  }
153
151
  if (duPoste) {
154
- // The night of the poste leaves the flow of the project the measures it declares it plays.
155
- const mesures =
156
- (enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0) &&
157
- !fluxDuProjetJoueLesMesures(racine);
152
+ // The night of the poste always plays the measures of time, whatever a flow of the project says.
153
+ const mesures = enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0;
158
154
  return [testsDuPoste(racine).length > 0 && 'du-poste', mesures && 'mesures'].filter(Boolean);
159
155
  }
160
156
  if (mesuresSeules) {
@@ -179,15 +175,13 @@ export function testsDeNuit(racine, options = {}) {
179
175
  if (runs.length === 0) {
180
176
  return 0;
181
177
  }
182
- // The night tests play on the part of the project, as a pass; the measures of time play on
183
- // dedicated cores (`grillhouse.mesure`) that nobody else touches, once the temporary directory
184
- // and the disk of the copy have room.
178
+ // The night tests and the measures of time play on a reservation of the arbiter, as a pass, once
179
+ // the temporary directory and the disk of the copy have room.
185
180
  const codes = runs.map(choix => {
186
181
  const mesure = choix === 'mesures';
187
182
  try {
188
183
  return avecLaPasse(() => jouerLeRun(racine, choix, options), {
189
184
  lourde: false,
190
- mesure,
191
185
  racine,
192
186
  sorte: mesure ? 'Mesures de nuit' : 'Nuit',
193
187
  });
@@ -62,7 +62,7 @@
62
62
  // removed at the end, green, red or interrupted (SIGINT, SIGTERM, SIGHUP).
63
63
  // The exit code is Turborepo's; 2 for a path refused.
64
64
  import { spawnSync } from 'node:child_process';
65
- import { accessSync, constants, existsSync, readdirSync, statSync } from 'node:fs';
65
+ import { existsSync, readdirSync, statSync } from 'node:fs';
66
66
  import path from 'node:path';
67
67
  import {
68
68
  AVANCEMENT,
@@ -71,11 +71,11 @@ import {
71
71
  DEPUIS_LE_VERT,
72
72
  mesure,
73
73
  ouvrirBase,
74
- paquetsDeLEnveloppe,
75
74
  retirerALInterruption,
76
75
  SCRIPT_DES_TESTS,
77
76
  surUnePart,
78
77
  TESTS_CIBLES,
78
+ lancerLesTests,
79
79
  testsCibles,
80
80
  tracesDuPlan,
81
81
  } from '../../services-du-noyau.mjs';
@@ -92,7 +92,6 @@ const racine = process.cwd();
92
92
  const base = ouvrirBase('tests');
93
93
  Object.assign(process.env, base.env);
94
94
  const lacher = retirerALInterruption(base.fermer);
95
- const enveloppe = paquetsDeLEnveloppe() !== null;
96
95
  const args = process.argv.slice(2);
97
96
  const force = args.includes('--force');
98
97
  const options = args.filter(a => a.startsWith('-') && a !== '--force');
@@ -158,42 +157,17 @@ const traces = (filtres, noms) => {
158
157
  // The tests <filtres> select, which receive <passes> in VARIABLE: one run with what they depend on;
159
158
  // in an envelope, the build of the packages they name with their own traces, then the tests alone.
160
159
  // Its exit code: the first that is not 0, else the tests'.
161
- const cibles = (filtres, passes) => {
162
- // `testsCibles` is undefined with no path and no `--force`: the variable then stays unset.
163
- const tests = testsCibles({ arguments: passes, force });
164
- if (!enveloppe) {
165
- return turbo([SCRIPT_DES_TESTS, ...filtres], tests);
166
- }
167
- // A package the envelope shows read-only arrives built: only the packages it shows in writing
168
- // build, as the envelope mounts them (`inscriptible`).
169
- const construits = filtres.filter(f => inscriptible(dossiers.get(f.slice('--filter='.length))));
170
- if (filtres.length === 0 || construits.length > 0) {
171
- const noms = new Set(construits.map(f => f.slice('--filter='.length)));
172
- const propres = construits.length ? traces(construits, noms) : { ids: [] };
173
- if (propres.code !== undefined) {
174
- return propres.code;
175
- }
176
- const construction = turbo(['build', ...propres.ids, '--only', ...construits]);
177
- if (construction !== 0) {
178
- return construction;
179
- }
180
- }
181
- return turbo([SCRIPT_DES_TESTS, '--only', ...filtres], tests);
182
- };
183
-
184
- // True when this process may write the directory <dir>: false under a read-only mount.
185
- const inscriptible = dir => {
186
- try {
187
- accessSync(dir, constants.W_OK);
188
- return true;
189
- } catch {
190
- return false;
191
- }
192
- };
160
+ const cibles = (filtres, passes) =>
161
+ lancerLesTests({
162
+ racine,
163
+ filtres,
164
+ // `testsCibles` is undefined with no path and no `--force`: the variable then stays unset.
165
+ tests: testsCibles({ arguments: passes, force }),
166
+ lancer: (args, tests) => turbo(args, tests),
167
+ traces,
168
+ });
193
169
 
194
170
  const liste = paquets(racine);
195
- // The directory of each package of the frame, by its name.
196
- const dossiers = new Map(liste.map(p => [p.pkg.name, path.join(racine, p.dossier)]));
197
171
 
198
172
  // The run the command asks for: its exit code.
199
173
  const lancer = () => {
@@ -31,7 +31,7 @@ import path from 'node:path';
31
31
  import { pathToFileURL } from 'node:url';
32
32
  import { deplacer, FICHIER, lire as lireDette, mesureDuPlan, trancher } from '../../dette.mjs';
33
33
  import { A_DEPLACER, A_ELAGUER, ecrireSarif } from '../../resultats.mjs';
34
- import { prefixe } from '../../services-du-noyau.mjs';
34
+ import { baseDuLot, prefixe } from '../../services-du-noyau.mjs';
35
35
  import { testsDuDepot } from './tailles-des-tests.mjs';
36
36
  import { TEST } from './vitest-config/lances.mjs';
37
37
 
@@ -172,8 +172,9 @@ function ressemblance(a, b) {
172
172
  * content (or nearly, at least half of the lines kept), are one rename.
173
173
  */
174
174
  export function renommesDuLot(racine) {
175
- const supprimes = git(racine, ['diff', 'HEAD', '--name-only', '--diff-filter=D', '-z']);
176
- const connus = git(racine, ['ls-tree', '-r', '--name-only', 'HEAD', '-z']);
175
+ const base = baseDuLot(racine) ?? 'HEAD';
176
+ const supprimes = git(racine, ['diff', base, '--name-only', '--diff-filter=D', '-z']);
177
+ const connus = git(racine, ['ls-tree', '-r', '--name-only', base, '-z']);
177
178
  if (supprimes.status !== 0 || connus.status !== 0) {
178
179
  return {};
179
180
  }
@@ -181,7 +182,7 @@ export function renommesDuLot(racine) {
181
182
  const avant = new Set(connus.stdout.split('\0'));
182
183
  const nouveaux = testsDuDepot(racine).filter(f => !avant.has(f));
183
184
  const textesAnciens = new Map(
184
- anciens.map(f => [f, git(racine, ['show', `HEAD:${f}`]).stdout ?? ''])
185
+ anciens.map(f => [f, git(racine, ['show', `${base}:${f}`]).stdout ?? ''])
185
186
  );
186
187
  const out = {};
187
188
  const pris = new Set();