@roomi-fields/grillhouse 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +769 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/bin/grillhouse.mjs +79 -18
  8. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  9. package/cadre/templates/projet/CLAUDE.md +5 -1
  10. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  11. package/cadre/templates/projet/package.json +2 -2
  12. package/charte.md +24 -0
  13. package/dist/temporal/acte.d.ts +24 -0
  14. package/dist/temporal/acte.js +139 -0
  15. package/dist/temporal/acte.js.map +1 -0
  16. package/dist/temporal/attributs.d.ts +6 -0
  17. package/dist/temporal/attributs.js +15 -0
  18. package/dist/temporal/attributs.js.map +1 -0
  19. package/dist/temporal/circuit/activites.d.ts +13 -0
  20. package/dist/temporal/circuit/activites.js +33 -0
  21. package/dist/temporal/circuit/activites.js.map +1 -0
  22. package/dist/temporal/circuit/client.d.ts +72 -0
  23. package/dist/temporal/circuit/client.js +247 -0
  24. package/dist/temporal/circuit/client.js.map +1 -0
  25. package/dist/temporal/circuit/commande.d.ts +2 -0
  26. package/dist/temporal/circuit/commande.js +238 -0
  27. package/dist/temporal/circuit/commande.js.map +1 -0
  28. package/dist/temporal/circuit/contrat.d.ts +305 -0
  29. package/dist/temporal/circuit/contrat.js +30 -0
  30. package/dist/temporal/circuit/contrat.js.map +1 -0
  31. package/dist/temporal/circuit/deroule.d.ts +3 -0
  32. package/dist/temporal/circuit/deroule.js +540 -0
  33. package/dist/temporal/circuit/deroule.js.map +1 -0
  34. package/dist/temporal/client.d.ts +47 -0
  35. package/dist/temporal/client.js +69 -0
  36. package/dist/temporal/client.js.map +1 -0
  37. package/dist/temporal/commande.d.ts +2 -0
  38. package/dist/temporal/commande.js +94 -0
  39. package/dist/temporal/commande.js.map +1 -0
  40. package/dist/temporal/deroules.d.ts +5 -0
  41. package/dist/temporal/deroules.js +10 -0
  42. package/dist/temporal/deroules.js.map +1 -0
  43. package/dist/temporal/etat.d.ts +33 -0
  44. package/dist/temporal/etat.js +59 -0
  45. package/dist/temporal/etat.js.map +1 -0
  46. package/dist/temporal/file/activites.d.ts +10 -0
  47. package/dist/temporal/file/activites.js +25 -0
  48. package/dist/temporal/file/activites.js.map +1 -0
  49. package/dist/temporal/file/client.d.ts +4 -0
  50. package/dist/temporal/file/client.js +6 -0
  51. package/dist/temporal/file/client.js.map +1 -0
  52. package/dist/temporal/file/contrat.d.ts +158 -0
  53. package/dist/temporal/file/contrat.js +14 -0
  54. package/dist/temporal/file/contrat.js.map +1 -0
  55. package/dist/temporal/file/deroule.d.ts +15 -0
  56. package/dist/temporal/file/deroule.js +235 -0
  57. package/dist/temporal/file/deroule.js.map +1 -0
  58. package/dist/temporal/installation.d.ts +120 -0
  59. package/dist/temporal/installation.js +386 -0
  60. package/dist/temporal/installation.js.map +1 -0
  61. package/dist/temporal/places/activites.d.ts +8 -0
  62. package/dist/temporal/places/activites.js +13 -0
  63. package/dist/temporal/places/activites.js.map +1 -0
  64. package/dist/temporal/places/client.d.ts +28 -0
  65. package/dist/temporal/places/client.js +64 -0
  66. package/dist/temporal/places/client.js.map +1 -0
  67. package/dist/temporal/places/contrat.d.ts +106 -0
  68. package/dist/temporal/places/contrat.js +21 -0
  69. package/dist/temporal/places/contrat.js.map +1 -0
  70. package/dist/temporal/places/deroule.d.ts +3 -0
  71. package/dist/temporal/places/deroule.js +198 -0
  72. package/dist/temporal/places/deroule.js.map +1 -0
  73. package/dist/temporal/sonde/activites.d.ts +6 -0
  74. package/dist/temporal/sonde/activites.js +52 -0
  75. package/dist/temporal/sonde/activites.js.map +1 -0
  76. package/dist/temporal/sonde/contrat.d.ts +35 -0
  77. package/dist/temporal/sonde/contrat.js +10 -0
  78. package/dist/temporal/sonde/contrat.js.map +1 -0
  79. package/dist/temporal/sonde/deroule.d.ts +3 -0
  80. package/dist/temporal/sonde/deroule.js +39 -0
  81. package/dist/temporal/sonde/deroule.js.map +1 -0
  82. package/dist/temporal/tickets/activites.d.ts +7 -0
  83. package/dist/temporal/tickets/activites.js +81 -0
  84. package/dist/temporal/tickets/activites.js.map +1 -0
  85. package/dist/temporal/tickets/client.d.ts +10 -0
  86. package/dist/temporal/tickets/client.js +31 -0
  87. package/dist/temporal/tickets/client.js.map +1 -0
  88. package/dist/temporal/tickets/contrat.d.ts +56 -0
  89. package/dist/temporal/tickets/contrat.js +13 -0
  90. package/dist/temporal/tickets/contrat.js.map +1 -0
  91. package/dist/temporal/tickets/deroule.d.ts +3 -0
  92. package/dist/temporal/tickets/deroule.js +94 -0
  93. package/dist/temporal/tickets/deroule.js.map +1 -0
  94. package/dist/temporal/travailleur.d.ts +2 -0
  95. package/dist/temporal/travailleur.js +69 -0
  96. package/dist/temporal/travailleur.js.map +1 -0
  97. package/docs/ARCHITECTURE.md +646 -87
  98. package/docs/CADRE.md +27 -0
  99. package/docs/INTERFACE.md +139 -42
  100. package/hooks/crochet.mjs +19 -2
  101. package/hooks/hooks.json +11 -0
  102. package/package.json +16 -4
  103. package/scripts/activites.mjs +2255 -0
  104. package/scripts/aiguillage.d.mts +37 -0
  105. package/scripts/aiguillage.mjs +40 -14
  106. package/scripts/avancement.mjs +155 -26
  107. package/scripts/bilan.mjs +137 -43
  108. package/scripts/cadre.mjs +16 -4
  109. package/scripts/circuit.mjs +993 -4075
  110. package/scripts/circuits-cles.d.mts +4 -0
  111. package/scripts/circuits-cles.mjs +21 -0
  112. package/scripts/circuits-du-serveur.mjs +105 -0
  113. package/scripts/codes-de-sortie.mjs +9 -0
  114. package/scripts/commandes-composees.mjs +45 -41
  115. package/scripts/commandes-du-path.d.mts +7 -0
  116. package/scripts/commandes-du-path.mjs +25 -0
  117. package/scripts/composants-affectes.mjs +64 -21
  118. package/scripts/composition-des-langages.mjs +18 -12
  119. package/scripts/conformite.mjs +56 -28
  120. package/scripts/copies-finies.mjs +52 -47
  121. package/scripts/depart-du-ticket.d.mts +53 -0
  122. package/scripts/depart-du-ticket.mjs +124 -0
  123. package/scripts/dependances-internes.mjs +121 -0
  124. package/scripts/dernier-vert.mjs +61 -34
  125. package/scripts/dette.mjs +32 -11
  126. package/scripts/donnees-cles.mjs +244 -0
  127. package/scripts/droits.mjs +51 -16
  128. package/scripts/effets.mjs +352 -0
  129. package/scripts/empreinte-d-etape.mjs +17 -0
  130. package/scripts/engendres.mjs +15 -5
  131. package/scripts/enveloppe/enveloppe.mjs +259 -55
  132. package/scripts/enveloppe/lancer.sh +14 -18
  133. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  134. package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
  135. package/scripts/etapes.mjs +5 -2
  136. package/scripts/faits-du-circuit.mjs +493 -0
  137. package/scripts/file-des-tickets.d.mts +21 -0
  138. package/scripts/file-des-tickets.mjs +58 -0
  139. package/scripts/flux-des-paquets.mjs +201 -0
  140. package/scripts/gardes-du-cadre.mjs +21 -5
  141. package/scripts/init.mjs +11 -4
  142. package/scripts/integration/file.mjs +544 -434
  143. package/scripts/integration/integrer.mjs +87 -43
  144. package/scripts/integration/rejeu.mjs +45 -13
  145. package/scripts/jointure.d.ts +151 -28
  146. package/scripts/langages/cargo/commandes.mjs +383 -124
  147. package/scripts/langages/cargo/composants.mjs +154 -42
  148. package/scripts/langages/cargo/exemples.mjs +12 -21
  149. package/scripts/langages/cargo/index.mjs +22 -8
  150. package/scripts/langages/cargo/sccache.mjs +8 -14
  151. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  152. package/scripts/langages/python/commandes.mjs +218 -100
  153. package/scripts/langages/python/composants.mjs +53 -21
  154. package/scripts/langages/python/exemples.mjs +6 -16
  155. package/scripts/langages/python/index.mjs +28 -8
  156. package/scripts/langages/python/lot.mjs +1 -36
  157. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  158. package/scripts/langages/typescript/composants.mjs +9 -3
  159. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  160. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  161. package/scripts/langages/typescript/construire.mjs +6 -163
  162. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  163. package/scripts/langages/typescript/exemples.mjs +3 -11
  164. package/scripts/langages/typescript/frontieres.mjs +66 -22
  165. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  166. package/scripts/langages/typescript/index.mjs +50 -61
  167. package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
  168. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  169. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  170. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  171. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  172. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  173. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
  174. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  175. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  176. package/scripts/langages/typescript/parcours.mjs +12 -4
  177. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  178. package/scripts/langages/typescript/resumes.mjs +9 -3
  179. package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
  180. package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
  181. package/scripts/langages/typescript/tests.mjs +40 -15
  182. package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
  183. package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
  184. package/scripts/langages/typescript/verdict.mjs +4 -2
  185. package/scripts/langages/typescript/verifier.mjs +58 -20
  186. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  187. package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
  188. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  189. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  190. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  191. package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
  192. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  193. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
  194. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
  195. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  196. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
  197. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  198. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  199. package/scripts/lint-des-scripts.mjs +58 -0
  200. package/scripts/mesure/base-de-passe.mjs +117 -25
  201. package/scripts/mesure/pression.mjs +12 -6
  202. package/scripts/mesure-de-la-machine.d.mts +21 -0
  203. package/scripts/mesure-de-la-machine.mjs +76 -0
  204. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  205. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  206. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  207. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
  208. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  209. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  210. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
  211. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  212. package/scripts/migrations.mjs +5 -0
  213. package/scripts/nuit.sh +25 -3
  214. package/scripts/outil.mjs +3 -1
  215. package/scripts/outils-cles.d.mts +24 -0
  216. package/scripts/outils-cles.mjs +18 -8
  217. package/scripts/paquet-npm.mjs +157 -0
  218. package/scripts/paquet.mjs +73 -4
  219. package/scripts/paquets.mjs +46 -10
  220. package/scripts/passe-de-la-machine.mjs +71 -0
  221. package/scripts/places-de-la-machine.mjs +414 -0
  222. package/scripts/places-du-serveur.mjs +170 -0
  223. package/scripts/prefixe-des-tickets.mjs +68 -0
  224. package/scripts/preparation.mjs +25 -8
  225. package/scripts/registre.mjs +9 -4
  226. package/scripts/regles-des-places.d.mts +36 -0
  227. package/scripts/regles-des-places.mjs +70 -0
  228. package/scripts/reponses-du-circuit.d.mts +6 -0
  229. package/scripts/reponses-du-circuit.mjs +28 -0
  230. package/scripts/reprise.mjs +66 -0
  231. package/scripts/resultats.mjs +112 -46
  232. package/scripts/retirer-les-copies-finies.mjs +25 -0
  233. package/scripts/sans-reponse.d.mts +4 -0
  234. package/scripts/sans-reponse.mjs +13 -0
  235. package/scripts/seances.mjs +936 -0
  236. package/scripts/services-du-noyau.mjs +27 -8
  237. package/scripts/session-start.sh +2 -2
  238. package/scripts/sortie.mjs +3 -3
  239. package/scripts/sous-commandes.mjs +41 -10
  240. package/scripts/style-a-l-ecriture.mjs +260 -0
  241. package/scripts/superviseur.mjs +122 -111
  242. package/scripts/tableau.mjs +180 -117
  243. package/scripts/taches-du-graphe.mjs +348 -0
  244. package/scripts/ticket-du-circuit.mjs +216 -0
  245. package/scripts/transitions.d.mts +148 -0
  246. package/scripts/transitions.mjs +1018 -0
  247. package/scripts/verrou-de-fichier.mjs +8 -4
  248. package/scripts/verrou-de-machine.mjs +150 -51
  249. package/scripts/verrous/commande.mjs +50 -17
  250. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  251. package/scripts/verrous/verrou.mjs +42 -14
  252. package/skills/explorateur/SKILL.md +9 -2
  253. package/skills/grill/SKILL.md +1 -1
  254. package/skills/mesure/SKILL.md +3 -0
  255. package/skills/pitmaster/SKILL.md +17 -18
  256. package/skills/pitmaster/references/consigne-agent.md +5 -1
  257. package/skills/release/SKILL.md +3 -3
  258. package/skills/relecteur/SKILL.md +5 -3
  259. package/skills/testwriter/SKILL.md +49 -31
  260. package/scripts/demon.mjs +0 -251
  261. package/scripts/integration/file-attente.mjs +0 -61
  262. package/scripts/langages/cargo/touches.mjs +0 -93
  263. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -76,11 +76,17 @@ const lireJson = p => JSON.parse(readFileSync(p, 'utf8'));
76
76
  // has none.
77
77
  export function sansApi(c) {
78
78
  const pj = path.join(c.dir, 'package.json');
79
- if (!existsSync(pj)) return false;
79
+ if (!existsSync(pj)) {
80
+ return false;
81
+ }
80
82
  const p = lireJson(pj);
81
83
  const exp = p.exports;
82
- if (exp === undefined) return [p.main, p.types, p.typings].every(e => e === undefined);
83
- if (!exp || typeof exp !== 'object' || Array.isArray(exp)) return false;
84
+ if (exp === undefined) {
85
+ return [p.main, p.types, p.typings].every(e => e === undefined);
86
+ }
87
+ if (!exp || typeof exp !== 'object' || Array.isArray(exp)) {
88
+ return false;
89
+ }
84
90
  const cles = Object.keys(exp);
85
91
  return cles.length > 0 && cles.every(k => k.startsWith('.')) && !cles.includes('.');
86
92
  }
@@ -97,7 +103,9 @@ export function entree(racine, c) {
97
103
  }
98
104
  const racinePj = path.join(racine, 'package.json');
99
105
  const types = existsSync(racinePj) ? lireJson(racinePj).types : null;
100
- if (!types) return null;
106
+ if (!types) {
107
+ return null;
108
+ }
101
109
  return path.join(racine, path.dirname(types), path.basename(c.dir), 'index.d.ts');
102
110
  }
103
111
 
@@ -108,14 +116,22 @@ export function declare(texte) {
108
116
  let section = null;
109
117
  let bloc = false;
110
118
  for (const l of ecrite(texte)) {
111
- if (/^\s*(```|~~~)/.test(l)) bloc = !bloc;
119
+ if (/^\s*(```|~~~)/.test(l)) {
120
+ bloc = !bloc;
121
+ }
112
122
  const titre = !bloc && /^(#{2,3}) (.+)$/.exec(l);
113
123
  if (titre) {
114
124
  section = titre[1] === '##' ? titre[2].trim() : section;
115
- if (section === 'Les fautes' && fautes === null) fautes = new Set();
125
+ if (section === 'Les fautes' && fautes === null) {
126
+ fautes = new Set();
127
+ }
116
128
  continue;
117
129
  }
118
- if (section === 'Les fautes') for (const m of l.matchAll(CODE)) fautes.add(m[0]);
130
+ if (section === 'Les fautes') {
131
+ for (const m of l.matchAll(CODE)) {
132
+ fautes.add(m[0]);
133
+ }
134
+ }
119
135
  }
120
136
  return { fautes };
121
137
  }
@@ -131,7 +147,9 @@ function codesDuCode(dir, racine, prefixes) {
131
147
  ).filter(p => SOURCE.test(nom(p)) && !isTest(path.relative(racine, p)));
132
148
  for (const p of sources) {
133
149
  for (const m of (lireSiPresent(p) ?? '').matchAll(CODE)) {
134
- if (prefixes.some(pr => m[0].startsWith(pr))) trouves.add(m[0]);
150
+ if (prefixes.some(pr => m[0].startsWith(pr))) {
151
+ trouves.add(m[0]);
152
+ }
135
153
  }
136
154
  }
137
155
  return trouves;
@@ -140,7 +158,7 @@ function codesDuCode(dir, racine, prefixes) {
140
158
  // Runs API Extractor on one component: whether the repository's report is up to date, the exports
141
159
  // of the documentation model built from the code (whether or not the report exists) and the TSDoc
142
160
  // messages of its comments.
143
- function rapportApi(racine, c, entreeDts, ecrire, tsdocConfigFile) {
161
+ export function rapportApi(racine, c, entreeDts, ecrire, tsdocConfigFile) {
144
162
  const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');
145
163
  const { ApiModel } = require('@microsoft/api-extractor-model');
146
164
  const pj = existsSync(path.join(c.dir, 'package.json'))
@@ -214,7 +232,9 @@ const CODE_SEUL = new RegExp(`^${CODE.source}$`);
214
232
 
215
233
  // The text of a TSDoc node, its paragraphs apart by a blank line, each on one line.
216
234
  function texteDoc(noeud) {
217
- if (!noeud) return '';
235
+ if (!noeud) {
236
+ return '';
237
+ }
218
238
  const feuilles = n =>
219
239
  n.kind === 'Excerpt' ? n.content.toString() : n.getChildNodes().map(feuilles).join('');
220
240
  const paragraphes = noeud.kind === 'Section' ? noeud.getChildNodes() : [noeud];
@@ -287,45 +307,54 @@ function fautesJugees(nom, textes, fautes, refus, codes) {
287
307
  regle: 'faute-hors-catalogue',
288
308
  texte: `${nom} : le @faute ${code} n'est pas au catalogue « ## Les fautes ».`,
289
309
  });
290
- } else codes.add(code);
310
+ } else {
311
+ codes.add(code);
312
+ }
291
313
  }
292
314
  }
293
315
 
294
316
  // The refusals for one export against its contract (`{ regle, texte }`), with the fault codes it
295
317
  // and its members name.
296
- function jugerExport(item, fautes) {
318
+ export function jugerExport(item, fautes) {
297
319
  const refus = [];
298
320
  const nom = `\`${item.displayName}\``;
299
321
  const k = contratDe(item);
300
- if (!k.resume) refus.push({ regle: 'resume', texte: `${nom} n'a pas de résumé TSDoc.` });
322
+ if (!k.resume) {
323
+ refus.push({ regle: 'resume', texte: `${nom} n'a pas de résumé TSDoc.` });
324
+ }
301
325
  const codes = new Set();
302
326
  if (estFonction(item)) {
303
327
  const noms = new Set(k.parametres.filter(p => !p.destructure).map(p => p.name));
304
328
  const prises = new Set();
305
329
  k.parametres.forEach((p, i) => {
306
330
  const parNom = p.destructure ? -1 : k.params.findIndex(b => b.nom === p.name);
307
- if (parNom >= 0) prises.add(parNom);
308
- else if (!p.destructure)
331
+ if (parNom >= 0) {
332
+ prises.add(parNom);
333
+ } else if (!p.destructure) {
309
334
  refus.push({
310
335
  regle: 'param',
311
336
  texte: `${nom} : le paramètre « ${p.name} » n'a pas de @param.`,
312
337
  });
313
- else if (!k.params[i] || noms.has(k.params[i].nom))
338
+ } else if (!k.params[i] || noms.has(k.params[i].nom)) {
314
339
  refus.push({
315
340
  regle: 'param',
316
341
  texte: `${nom} : le paramètre déstructuré en position ${i + 1} n'a pas son @param à cette position.`,
317
342
  });
318
- else prises.add(i);
343
+ } else {
344
+ prises.add(i);
345
+ }
319
346
  });
320
347
  k.params.forEach((b, i) => {
321
- if (!prises.has(i))
348
+ if (!prises.has(i)) {
322
349
  refus.push({
323
350
  regle: 'param-orphelin',
324
351
  texte: `${nom} : le @param « ${b.nom} » ne nomme aucun paramètre.`,
325
352
  });
353
+ }
326
354
  });
327
- if (k.rendUneValeur && k.retour === null)
355
+ if (k.rendUneValeur && k.retour === null) {
328
356
  refus.push({ regle: 'returns', texte: `${nom} rend une valeur mais n'a pas de @returns.` });
357
+ }
329
358
  }
330
359
  fautesJugees(nom, k.fautes, fautes, refus, codes);
331
360
  for (const m of item.members ?? []) {
@@ -350,19 +379,28 @@ export function marques(texte) {
350
379
  lignes.forEach((l, i) => {
351
380
  const f = /^\s*(```|~~~)/.exec(l);
352
381
  if (cloture) {
353
- if (f && f[1] === cloture) cloture = null;
382
+ if (f && f[1] === cloture) {
383
+ cloture = null;
384
+ }
354
385
  return;
355
386
  }
356
387
  if (f) {
357
388
  cloture = f[1];
358
389
  return;
359
390
  }
360
- if (l.trim() === DEBUT) debuts.push(i);
361
- if (l.trim() === FIN) fins.push(i);
391
+ if (l.trim() === DEBUT) {
392
+ debuts.push(i);
393
+ }
394
+ if (l.trim() === FIN) {
395
+ fins.push(i);
396
+ }
362
397
  });
363
- if (!debuts.length && !fins.length) return { etat: 'absentes', lignes };
364
- if (debuts.length === 1 && fins.length === 1 && debuts[0] < fins[0])
398
+ if (!debuts.length && !fins.length) {
399
+ return { etat: 'absentes', lignes };
400
+ }
401
+ if (debuts.length === 1 && fins.length === 1 && debuts[0] < fins[0]) {
365
402
  return { etat: 'ok', lignes, debut: debuts[0], fin: fins[0] };
403
+ }
366
404
  return { etat: 'invalides', lignes };
367
405
  }
368
406
 
@@ -379,10 +417,12 @@ const signature = item => {
379
417
  /^(?:(?:export|declare|default|async)\s+)*(?:function|class|interface|type|enum|namespace|const|let|var)\b/.test(
380
418
  texte
381
419
  )
382
- )
420
+ ) {
383
421
  return texte;
384
- if (item.kind === 'Variable')
422
+ }
423
+ if (item.kind === 'Variable') {
385
424
  return `export declare ${item.isReadonly ? 'const' : 'let'} ${texte}`;
425
+ }
386
426
  return item.kind === 'Function' ? `const ${texte}` : texte;
387
427
  };
388
428
 
@@ -391,15 +431,21 @@ const signature = item => {
391
431
  function entreeDe(item) {
392
432
  const k = contratDe(item);
393
433
  const out = [`### \`${item.displayName}\``, ''];
394
- if (k.resume) out.push(k.resume, '');
434
+ if (k.resume) {
435
+ out.push(k.resume, '');
436
+ }
395
437
  out.push('```ts', `${signature(item)};`, '```');
396
438
  const params = k.params.filter(b => b.texte);
397
- if (params.length)
439
+ if (params.length) {
398
440
  out.push('', '**Paramètres**', '', ...params.map(b => `- \`${b.nom}\` — ${b.texte}`));
399
- if (k.retour) out.push('', `**Retour** — ${k.retour}`);
441
+ }
442
+ if (k.retour) {
443
+ out.push('', `**Retour** — ${k.retour}`);
444
+ }
400
445
  const codes = [...new Set(k.fautes.map(f => f.replace(/\s+/g, ' ')))];
401
- if (codes.length)
446
+ if (codes.length) {
402
447
  out.push('', '**Fautes**', '', ...codes.map(f => `- ${f.replace(/^(\S+)/, '`$1`')}`));
448
+ }
403
449
  const membres = [...(item.members ?? [])];
404
450
  if (membres.length) {
405
451
  out.push('', '**Membres**', '');
@@ -412,14 +458,15 @@ function entreeDe(item) {
412
458
  }
413
459
 
414
460
  // The text between the marks for <exports>: empty without export.
415
- const partieGeneree = exports =>
461
+ export const partieGeneree = exports =>
416
462
  exports.length ? `\n${exports.map(entreeDe).join('\n\n')}\n\n` : '\n';
417
463
 
418
464
  // The text of an interface with its generated part replaced; the marks are added at the end of a
419
465
  // text that has none.
420
- function avecPartie(m, texte, partie) {
421
- if (m.etat === 'absentes')
466
+ export function avecPartie(m, texte, partie) {
467
+ if (m.etat === 'absentes') {
422
468
  return `${texte}${texte.endsWith('\n') ? '' : '\n'}\n${DEBUT}${partie}${FIN}\n`;
469
+ }
423
470
  const avant = m.lignes.slice(0, m.debut).join('\n');
424
471
  const apres = m.lignes.slice(m.fin + 1).join('\n');
425
472
  return `${avant}${m.debut ? '\n' : ''}${DEBUT}${partie}${FIN}\n${apres}`;
@@ -456,7 +503,9 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
456
503
  const { fautes } = declare(texte);
457
504
  const m = marques(texte);
458
505
  if (sansApi(c)) {
459
- if (fautes) codesContreCatalogue(c, racine, fautes, refuser);
506
+ if (fautes) {
507
+ codesContreCatalogue(c, racine, fautes, refuser);
508
+ }
460
509
  return { refus, signaux };
461
510
  }
462
511
  if (m.etat === 'invalides') {
@@ -474,7 +523,9 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
474
523
  const { TSDocConfigFile } = require('@microsoft/tsdoc-config');
475
524
  const config = TSDocConfigFile.loadFile(fichierTsdoc);
476
525
  const api = rapportApi(racine, c, dts, ecrire, config);
477
- for (const msg of api.messages) signaux.push(`${rel} : ${msg}`);
526
+ for (const msg of api.messages) {
527
+ signaux.push(`${rel} : ${msg}`);
528
+ }
478
529
  for (const t of api.tsdoc) {
479
530
  refuser(`TSDoc : ${t.texte}`, t.regle, t.fichier ?? relIface, t.ligne);
480
531
  }
@@ -493,17 +544,24 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
493
544
  const nommees = new Set();
494
545
  for (const item of api.exports) {
495
546
  const j = jugerExport(item, fautes);
496
- for (const r of j.refus) refuser(r.texte, r.regle);
497
- for (const code of j.codes) nommees.add(code);
547
+ for (const r of j.refus) {
548
+ refuser(r.texte, r.regle);
549
+ }
550
+ for (const code of j.codes) {
551
+ nommees.add(code);
552
+ }
498
553
  }
499
554
  for (const f of fautes ?? []) {
500
- if (!nommees.has(f))
555
+ if (!nommees.has(f)) {
501
556
  refuser(`la faute ${f} du catalogue n'est nommée par aucun @faute.`, 'faute-non-nommee');
557
+ }
502
558
  }
503
559
  if (m.etat !== 'invalides') {
504
560
  const attendu = avecPartie(m, texte, partieGeneree(api.exports));
505
561
  if (ecrire) {
506
- if (attendu !== texte) writeFileSync(iface, attendu);
562
+ if (attendu !== texte) {
563
+ writeFileSync(iface, attendu);
564
+ }
507
565
  } else if (attendu !== texte) {
508
566
  aRegenerer(
509
567
  `la part générée de docs/INTERFACE.md (entre ${DEBUT} et ${FIN}) n'est pas celle du code ; npm run api la refait.`,
@@ -512,7 +570,9 @@ export function verifierComposant(racine, c, { ecrire = false } = {}) {
512
570
  }
513
571
  }
514
572
  }
515
- if (fautes) codesContreCatalogue(c, racine, fautes, refuser);
573
+ if (fautes) {
574
+ codesContreCatalogue(c, racine, fautes, refuser);
575
+ }
516
576
  return { refus, signaux };
517
577
  }
518
578
 
@@ -522,12 +582,14 @@ function codesContreCatalogue(c, racine, fautes, refuser) {
522
582
  const prefixes = [...new Set([...fautes].map(f => f.slice(0, f.indexOf('_') + 1)))];
523
583
  const dansLeCode = codesDuCode(c.dir, racine, prefixes);
524
584
  for (const f of fautes) {
525
- if (!dansLeCode.has(f))
585
+ if (!dansLeCode.has(f)) {
526
586
  refuser(`la faute ${f} est listée, mais le code ne la produit pas.`, 'faute-non-produite');
587
+ }
527
588
  }
528
589
  for (const f of dansLeCode) {
529
- if (!fautes.has(f))
590
+ if (!fautes.has(f)) {
530
591
  refuser(`le code produit ${f}, que « Les fautes » ne liste pas.`, 'faute-non-listee');
592
+ }
531
593
  }
532
594
  }
533
595
 
@@ -546,11 +608,17 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
546
608
  const constats = [];
547
609
  for (const c of aVerifier(racine)) {
548
610
  const { refus, signaux } = verifierComposant(racine, c, { ecrire });
549
- for (const s of signaux) process.stderr.write(`⚠️ ${s}\n`);
611
+ for (const s of signaux) {
612
+ process.stderr.write(`⚠️ ${s}\n`);
613
+ }
550
614
  constats.push(...refus);
551
615
  }
552
616
  const { refus, lignes } = trancher(racine, 'interfaces-contre-code', constats);
553
- for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
554
- for (const l of lignes) process.stderr.write(`${l}\n`);
617
+ for (const r of refus) {
618
+ process.stderr.write(`⛔ ${r.message}\n`);
619
+ }
620
+ for (const l of lignes) {
621
+ process.stderr.write(`${l}\n`);
622
+ }
555
623
  process.exitCode = refus.length ? 1 : 0;
556
624
  }
@@ -41,7 +41,9 @@ function sourcesDe(tous) {
41
41
  return tous.flatMap(c =>
42
42
  parcourir(c.dir, p => SAUTES.has(path.basename(p)))
43
43
  .filter(f => {
44
- if (!SOURCE.test(f) || NOM_DE_TEST.test(path.basename(f))) return false;
44
+ if (!SOURCE.test(f) || NOM_DE_TEST.test(path.basename(f))) {
45
+ return false;
46
+ }
45
47
  return !path
46
48
  .relative(c.dir, f)
47
49
  .split(path.sep)
@@ -56,7 +58,9 @@ function interfacesDe(racine, tous) {
56
58
  const out = new Map();
57
59
  for (const c of tous) {
58
60
  const f = path.join(c.dir, 'docs', 'INTERFACE.md');
59
- if (!existsSync(f)) continue;
61
+ if (!existsSync(f)) {
62
+ continue;
63
+ }
60
64
  const i = lire(path.relative(racine, f).split(path.sep).join('/'), readFileSync(f, 'utf8'));
61
65
  const publies = new Set(
62
66
  i.parties.filter(p => !p.consommateurs).map(p => p.titre.replace(/`/g, '').trim())
@@ -71,7 +75,9 @@ function interfacesDe(racine, tous) {
71
75
  // files left out.
72
76
  function testsDe(c) {
73
77
  return parcourir(c.dir, p => SAUTES.has(path.basename(p))).filter(f => {
74
- if (!SOURCE.test(f)) return false;
78
+ if (!SOURCE.test(f)) {
79
+ return false;
80
+ }
75
81
  const rel = path.relative(c.dir, f).split(path.sep);
76
82
  return NOM_DE_TEST.test(path.basename(f)) || rel.some(d => DOSSIERS_DE_TEST.has(d));
77
83
  });
@@ -102,11 +108,12 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
102
108
  const ifaces = interfacesDe(racine, tous);
103
109
  const tests = new Map();
104
110
  const testsDuComposant = c => {
105
- if (!tests.has(c))
111
+ if (!tests.has(c)) {
106
112
  tests.set(
107
113
  c,
108
114
  testsDe(c).map(f => ({ f, texte: lireSiPresent(f) ?? '' }))
109
115
  );
116
+ }
110
117
  return tests.get(c);
111
118
  };
112
119
  const elements = [];
@@ -114,25 +121,35 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
114
121
  for (const nom of noms) {
115
122
  const fournisseurs = tous.filter(c => ifaces.get(c)?.publies.has(nom));
116
123
  if (fournisseurs.length === 0) {
117
- if (!tous.some(c => c.paquet === nom)) sansFournisseur.push(nom);
124
+ if (!tous.some(c => c.paquet === nom)) {
125
+ sansFournisseur.push(nom);
126
+ }
118
127
  continue;
119
128
  }
120
129
  for (const p of fournisseurs) {
121
130
  const lus = [];
122
131
  for (const c of tous) {
123
- if (c === p) continue;
132
+ if (c === p) {
133
+ continue;
134
+ }
124
135
  const par = [];
125
136
  const declare =
126
137
  ifaces.get(p).consommateurs.get(c.nom) ?? ifaces.get(p).consommateurs.get(c.paquet);
127
- if (declare && (declare.has(nom) || declare.has('*'))) par.push('consommateurs');
138
+ if (declare && (declare.has(nom) || declare.has('*'))) {
139
+ par.push('consommateurs');
140
+ }
128
141
  const n = reel.get(p.nom)?.get(c.nom);
129
- if (n && (n.has(nom) || n.has('*'))) par.push('import');
142
+ if (n && (n.has(nom) || n.has('*'))) {
143
+ par.push('import');
144
+ }
130
145
  for (const t of testsDuComposant(c)) {
131
146
  if (identifiant(nom).test(t.texte) && importe(t.texte, t.f, p)) {
132
147
  par.push(path.relative(racine, t.f).split(path.sep).join('/'));
133
148
  }
134
149
  }
135
- if (par.length) lus.push({ composant: exterieur(c), par });
150
+ if (par.length) {
151
+ lus.push({ composant: exterieur(c), par });
152
+ }
136
153
  }
137
154
  elements.push({ nom, fournisseur: exterieur(p), lecteurs: lus });
138
155
  }
@@ -149,10 +166,18 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
149
166
  const lit = new Map(composants.map(c => [c, new Set()]));
150
167
  for (const p of tous) {
151
168
  for (const nomLecteur of reel.get(p.nom)?.keys() ?? []) {
152
- for (const c of tous) if (c.nom === nomLecteur) lit.get(c.c).add(p.c);
169
+ for (const c of tous) {
170
+ if (c.nom === nomLecteur) {
171
+ lit.get(c.c).add(p.c);
172
+ }
173
+ }
174
+ }
175
+ }
176
+ for (const e of elements) {
177
+ for (const l of e.lecteurs) {
178
+ lit.get(l.composant).add(e.fournisseur);
153
179
  }
154
180
  }
155
- for (const e of elements) for (const l of e.lecteurs) lit.get(l.composant).add(e.fournisseur);
156
181
  const parLesTests = new Map(composants.map(c => [c, new Set()]));
157
182
  for (const [c, lus] of testsLisent) {
158
183
  for (const p of lus) {
@@ -53,14 +53,18 @@ export function migrer(projet) {
53
53
  }
54
54
  }
55
55
  const fracine = path.join(projet, 'package.json');
56
- if (!existsSync(fracine)) return lignes;
56
+ if (!existsSync(fracine)) {
57
+ return lignes;
58
+ }
57
59
  const racine = lireJson(fracine);
58
60
  const plage =
59
61
  CHAMPS.map(c => racine[c]?.[PAQUET]).find(v => v !== undefined) ?? `^${versionDuCadre()}`;
60
62
  const declarer = pkg => {
61
63
  let change = false;
62
64
  for (const c of CHAMPS) {
63
- if (pkg[c]?.[ANCIEN] === undefined) continue;
65
+ if (pkg[c]?.[ANCIEN] === undefined) {
66
+ continue;
67
+ }
64
68
  const { [ANCIEN]: _ancien, ...reste } = pkg[c];
65
69
  const deja = CHAMPS.some(d => pkg[d]?.[PAQUET] !== undefined);
66
70
  pkg[c] = Object.fromEntries(
@@ -73,12 +77,16 @@ export function migrer(projet) {
73
77
  return change;
74
78
  };
75
79
  for (const { dossier, pkg } of paquets(projet)) {
76
- if (ANCIENS_ESPACES.includes(dossier) || !declarer(pkg)) continue;
80
+ if (ANCIENS_ESPACES.includes(dossier) || !declarer(pkg)) {
81
+ continue;
82
+ }
77
83
  ecrireJson(path.join(projet, dossier, 'package.json'), pkg);
78
84
  lignes.push(`${dossier}/package.json : déclare ${PAQUET} à la place de ${ANCIEN}`);
79
85
  }
80
86
  const declare = declarer(racine);
81
- if (declare) lignes.push(`package.json : déclare ${PAQUET} à la place de ${ANCIEN}`);
87
+ if (declare) {
88
+ lignes.push(`package.json : déclare ${PAQUET} à la place de ${ANCIEN}`);
89
+ }
82
90
  const liste = Array.isArray(racine.workspaces) ? racine.workspaces : racine.workspaces?.packages;
83
91
  const restants = Array.isArray(liste) ? liste.filter(e => !ANCIENS_ESPACES.includes(e)) : liste;
84
92
  const espaces = Array.isArray(liste) && restants.length !== liste.length;
@@ -88,6 +96,8 @@ export function migrer(projet) {
88
96
  : { ...racine.workspaces, packages: restants };
89
97
  lignes.push(`package.json : l'ancien dossier de ${ANCIEN} quitte les workspaces`);
90
98
  }
91
- if (declare || espaces) ecrireJson(fracine, racine);
99
+ if (declare || espaces) {
100
+ ecrireJson(fracine, racine);
101
+ }
92
102
  return lignes;
93
103
  }
@@ -17,9 +17,13 @@ export const nom = 'chemins des tests';
17
17
 
18
18
  /** Inscribes the paths the tests of the project at <projet> name undeclared; what it did. */
19
19
  export function migrer(projet) {
20
- if (lire(projet)[GARDE]) return [];
20
+ if (lire(projet)[GARDE]) {
21
+ return [];
22
+ }
21
23
  const constats = verifier(projet);
22
- if (constats.length === 0) return [];
24
+ if (constats.length === 0) {
25
+ return [];
26
+ }
23
27
  trancher(projet, GARDE, constats, 'inscrire', {});
24
28
  return [
25
29
  `${FICHIER} : ${constats.length} chemin(s) qu'un test nomme sans que le cadre le lise, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chaque test écrit le chemin entier`,
@@ -21,9 +21,13 @@ export const nom = 'tailles des tests';
21
21
 
22
22
  /** Inscribes the large tests of the day of the project at <projet> in its debt; what it did. */
23
23
  export function migrer(projet) {
24
- if (lire(projet)[GARDE]) return [];
24
+ if (lire(projet)[GARDE]) {
25
+ return [];
26
+ }
25
27
  const constats = verifier(projet);
26
- if (constats.length === 0) return [];
28
+ if (constats.length === 0) {
29
+ return [];
30
+ }
27
31
  trancher(projet, GARDE, constats, 'inscrire', {});
28
32
  return [
29
33
  `${FICHIER} : ${constats.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (*.nuit.test.*) ou se réduit`,
@@ -0,0 +1,63 @@
1
+ // From 0.30.0 the guard of the titles of the tests (scripts/langages/typescript/titres-de-tests.mjs)
2
+ // reads the prefix of the tickets from the key `issue-prefix` of `.beads/config.yaml`, committed,
3
+ // never from `bd`, which a CI does not have; a project without the key is refused by the guard.
4
+ // `bd init` writes that key commented out, and Beads keeps the prefix in its database.
5
+ //
6
+ // - The migration writes the key `issue-prefix: "<prefix>"` in `.beads/config.yaml` by the one
7
+ // writer of the key (`ecrireLePrefixe` of scripts/prefixe-des-tickets.mjs, which the preparation
8
+ // of a new project calls too), the prefix read once from Beads (`bd config get issue_prefix`,
9
+ // in the project), as the update runs at the poste, where bd is.
10
+ // - A file that already holds the key with a value is left, nothing said: a second pass changes
11
+ // nothing.
12
+ // - A project without `.beads/` holds no tickets of Beads in this tree: nothing to write. With
13
+ // `.beads/` but without its `config.yaml`, or a prefix Beads does not give, `aFaire` names the
14
+ // key to write.
15
+ import { spawnSync } from 'node:child_process';
16
+ import { existsSync } from 'node:fs';
17
+ import path from 'node:path';
18
+ import { CONFIG_BEADS as CONFIG, ecrireLePrefixe, prefixe } from '../../../services-du-noyau.mjs';
19
+
20
+ export const version = '0.30.0';
21
+ export const nom = 'préfixe des tickets';
22
+
23
+ // The prefix Beads gives in the project at <projet>, null without one.
24
+ function prefixeDeBeads(projet) {
25
+ const r = spawnSync('bd', ['config', 'get', 'issue_prefix'], {
26
+ cwd: projet,
27
+ encoding: 'utf8',
28
+ maxBuffer: 256 * 1024 * 1024,
29
+ });
30
+ const valeur = r.status === 0 ? String(r.stdout ?? '').trim() : '';
31
+ return valeur && !/\s/.test(valeur) ? valeur : null;
32
+ }
33
+
34
+ /** Writes the key `issue-prefix` of the project at <projet> when it lacks it; what it did. */
35
+ export function migrer(projet) {
36
+ const f = path.join(projet, CONFIG);
37
+ if (!existsSync(path.dirname(f))) {
38
+ return [];
39
+ }
40
+ if (!existsSync(f)) {
41
+ return [
42
+ {
43
+ aFaire: `${CONFIG} manque : écris-y la clé \`issue-prefix: "<préfixe>"\`, que la garde des titres des tests lit.`,
44
+ },
45
+ ];
46
+ }
47
+ try {
48
+ prefixe(projet);
49
+ return [];
50
+ } catch {
51
+ // The key is missing or empty: it is written below.
52
+ }
53
+ const valeur = prefixeDeBeads(projet);
54
+ if (!valeur) {
55
+ return [
56
+ {
57
+ aFaire: `${CONFIG} : Beads ne donne pas le préfixe des tickets (\`bd config get issue_prefix\`) ; écris la clé \`issue-prefix: "<préfixe>"\`, que la garde des titres des tests lit.`,
58
+ },
59
+ ];
60
+ }
61
+ const ligne = ecrireLePrefixe(projet, valeur);
62
+ return ligne ? [`${CONFIG} : ${ligne}, lu de Beads, que la garde des titres des tests lit`] : [];
63
+ }
@@ -0,0 +1,33 @@
1
+ // From 0.30.0 the guard of the sizes of the tests (scripts/langages/typescript/tailles-des-tests.mjs)
2
+ // also sees large a test that mounts a temporary directory and starts a heavy tool of the product
3
+ // there (turbo, vitest, knip, depcruise, api-extractor), with a `cwd:`; the tests it classed medium
4
+ // become large tests of the day, and the main of a project that updates would turn red at its next
5
+ // pass. As the migration 0.25.0 does for the first rule, the update inscribes them as the project's
6
+ // known debt (scripts/dette.mjs), frozen: the count never rises and a new large test of the day is
7
+ // refused.
8
+ //
9
+ // - The migration inscribes the large tests of the day the guard finds that the debt does not hold
10
+ // yet; the debt already inscribed (the guard's, the other guards') stays.
11
+ // - It rewrites no test of the project: the project moves each one to the night (`*.nuit.test.*`)
12
+ // or reduces it, and the debt comes down with it.
13
+ // - Replayable without effect: once every finding is inscribed, nothing.
14
+ import { FICHIER, lire, trancher } from '../../../dette.mjs';
15
+ import { GARDE, verifier } from '../tailles-des-tests.mjs';
16
+
17
+ export const version = '0.30.0';
18
+ export const nom = 'tailles des outils lourds';
19
+
20
+ /** Inscribes the large tests of the day the debt of the project at <projet> lacks; what it did. */
21
+ export function migrer(projet) {
22
+ const inscrite = lire(projet)[GARDE] ?? {};
23
+ const constats = verifier(projet);
24
+ const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
25
+ if (neufs.length === 0) {
26
+ return [];
27
+ }
28
+ // Inscribed counts stay; a finding without key is added at its count.
29
+ trancher(projet, GARDE, constats, 'inscrire', {});
30
+ return [
31
+ `${FICHIER} : ${neufs.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (*.nuit.test.*) ou se réduit`,
32
+ ];
33
+ }
@@ -0,0 +1,40 @@
1
+ // From 0.30.0 the guard of the titles of the tests (scripts/langages/typescript/titres-de-tests.mjs)
2
+ // refuses a test file whose titles name a ticket or a « critère N » beyond its debt; the titles a
3
+ // project already has would turn its main red at its next pass. As the migration of the large
4
+ // tests of the day does (./0.30.0-tailles-des-outils-lourds.mjs), the update inscribes them as the
5
+ // project's known debt (scripts/dette.mjs), frozen: the count never rises, and each title renamed
6
+ // by its behaviour lowers it.
7
+ //
8
+ // - It plays after the migration of the prefix of the tickets (./0.30.0-prefixe-des-tickets.mjs),
9
+ // whose key it reads; without the key it inscribes nothing, and the guard names the key.
10
+ // - The migration inscribes the files the debt does not hold yet; the debt already inscribed (the
11
+ // guard's, the other guards') stays.
12
+ // - It rewrites no test of the project.
13
+ // - Replayable without effect: once every finding is inscribed, nothing.
14
+ import { FICHIER, lire, trancher } from '../../../dette.mjs';
15
+ import { prefixe } from '../../../services-du-noyau.mjs';
16
+ import { GARDE, verifier } from '../titres-de-tests.mjs';
17
+
18
+ export const version = '0.30.0';
19
+ export const nom = 'titres nommant un ticket';
20
+
21
+ /** Inscribes the titles naming a ticket that the debt of the project at <projet> lacks; what it did. */
22
+ export function migrer(projet) {
23
+ let pref;
24
+ try {
25
+ pref = prefixe(projet);
26
+ } catch {
27
+ return [];
28
+ }
29
+ const inscrite = lire(projet)[GARDE] ?? {};
30
+ const constats = verifier(projet, pref);
31
+ const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
32
+ if (neufs.length === 0) {
33
+ return [];
34
+ }
35
+ trancher(projet, GARDE, constats, 'inscrire', {});
36
+ const fichiers = new Set(neufs.map(c => c.fichier)).size;
37
+ return [
38
+ `${FICHIER} : ${neufs.length} titre(s) de test nommant un ticket ou un « critère N », dans ${fichiers} fichier(s), inscrit(s) dans la dette de ${GARDE}, gelée ; chacun se renomme par son comportement, et la dette baisse avec lui`,
39
+ ];
40
+ }